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

Flipping demand #862

Merged
merged 26 commits into from
Feb 27, 2021
Merged

Flipping demand #862

merged 26 commits into from
Feb 27, 2021

Conversation

Anton-Latukha
Copy link
Collaborator

@Anton-Latukha Anton-Latukha commented Feb 26, 2021

A milestone stage towards #850

Remember that force would lose the functional argument.
demand would be something along the lines of free -> f =<< force thunk.

By the result of the demand - it would be seen, is in viable to keep it, or simply replace with that free -> f =<< force thunk or move free logic into force and use force with =<<.

So instead of the demand it would be between function and its argument would be force v.

In other words, unflipping required to unfold the code.

But the further following folded elegantness worth it.

Also all those \case really are helper functions that explain themself.

Or, alg if you want.

Hardly a better refactor currently. But after the proper the further work on
`force` going to give beautiful code:
```haskell
f =
  pure $
    case
      free
        force
        id
    of
      NVStr' s -> pure s
      _        -> mempty
```
…tion

Argument order change has functional argument - so it is not possible to
elegantly switch into new code, and requires to go though transition.

So doing the work while doing needed refactoring at the same time.

This style of code currenly may seem more noizy, but really it is more
straight-forward, it mentions only operations & transformatios, types can be
looked in the HLS.

With the future work #850
this style of the code would radically start to simplify itself, so please bear
with me.
@Anton-Latukha Anton-Latukha changed the title Flipping class MonadValue: demand Flipping demand Feb 26, 2021
@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Feb 26, 2021

Currently surprised the benchmark saves are still small.

Sadly, the benchmarks so far not show huge improvement.

But need to inspect the profiling more.

I wait on one at the end of #850.

But more and more thinking that 1-threadness with no system of lock management, flipped style in which the project was created produces unoptimized code and lazy boxed types are the main points. Maybe they are the main nails performance hangs on in the thunk processing.

The more we streamline the code - the more magnitude of the gains would start to snowball.

@Anton-Latukha Anton-Latukha mentioned this pull request Feb 26, 2021
@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Feb 27, 2021

Awakened the swarm nest for project improvements:

#864
#861
#850
#776

, and others.

Checked for it to eval Nixpkgs in the same way. During evaluations found several typos, until evaluations became same.

@Anton-Latukha Anton-Latukha merged commit 60a3a80 into master Feb 27, 2021
@Anton-Latukha Anton-Latukha deleted the 2021-02-25-flipping-demand branch February 27, 2021 15:14
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

Successfully merging this pull request may close these issues.

1 participant