Skip to content

Can we improve reschedule? #53

@treeowl

Description

@treeowl
reschedule queue@Sched{ workpool } = do
  e <- atomicModifyIORef workpool $ \ts ->
         case ts of
           []      -> ([], Nothing)
           (t:ts') -> (ts', Just t)
 --[...]

The pairs will actually be realized, because atomicModifyIORef needs them. But I suspect that atomicModifyIORef is actually overkill in this case. In particular, we only deconstruct ts; we don't have to construct any new values. I suspect, therefore, that casMutVar# can do the job more cheaply. Benchmarking will be needed to test this hypothesis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions