Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant code in TaskMetaData.addProfile #169

Open
vsilaev opened this issue Dec 24, 2021 · 0 comments
Open

Redundant code in TaskMetaData.addProfile #169

vsilaev opened this issue Dec 24, 2021 · 0 comments

Comments

@vsilaev
Copy link
Contributor

vsilaev commented Dec 24, 2021

TaskMetaData has the following code where profiles map is used twice to get same value:

    public void addProfile(int id) {
        final TornadoAcceleratorDevice device = getLogicDevice();
        BitSet events;
        profiles.computeIfAbsent(device, k -> new BitSet(EVENT_WINDOW));
        events = profiles.get(device);
        events.set(id);
    }

The simpler version is:

    public void addProfile(int id) {
        BitSet events = profiles.computeIfAbsent(getLogicDevice(), k -> new BitSet(EVENT_WINDOW));
        events.set(id);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant