TornadoVM icon indicating copy to clipboard operation
TornadoVM copied to clipboard

Redundant code in TaskMetaData.addProfile

Open vsilaev opened this issue 2 years ago • 0 comments

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);
    }

vsilaev avatar Dec 24 '21 14:12 vsilaev