#63 CQuery: callback & counters

Zavřený
otevřeno před 4 roky uživatelem ranides · 2 komentářů
ranides okomentoval před 4 roky

Replace int[]{0} with AtomicInteger / Counter

Replace boolean[]{false} with AtomicBool / Terminator / Continuator

Those counter and terminators should be created by CQuery internal protected methods. Those methods will return "just wrapper", non-blocking wrapper or synchronized wrapper (which will make parallel query sequential).

...

No, we don't need protected methods because every implementation of each, while etc will use different iteration strategy, especially parallel methods could use some form of non-blocking but splittable counters.

For example, it is trivial to create as many counters as threads and initialize with correct offset, when we split array processing.

Replace `int[]{0}` with AtomicInteger / Counter Replace `boolean[]{false}` with AtomicBool / Terminator / Continuator Those counter and terminators should be created by CQuery internal protected methods. Those methods will return "just wrapper", non-blocking wrapper or synchronized wrapper (which will make parallel query sequential). ... No, we don't need protected methods because every implementation of `each`, `while` etc will use different iteration strategy, especially parallel methods could use some form of non-blocking but splittable counters. For example, it is trivial to create as many counters as threads and initialize with correct offset, when we split array processing.
ranides znovuotevřel před 4 roky
ranides okomentoval před 4 roky
Vlastník

reopened. prefer something like zip method rather than atomic counters

https://stackoverflow.com/questions/17640754/zipping-streams-using-jdk8-with-lambda-java-util-stream-streams-zip

Essentially, the point is to not use stream directly, but use stream.spliterator and then implement loops manually.

reopened. prefer something like `zip` method rather than atomic counters https://stackoverflow.com/questions/17640754/zipping-streams-using-jdk8-with-lambda-java-util-stream-streams-zip **Essentially, the point is to not use stream directly, but use `stream.spliterator` and then implement loops manually.**
ranides okomentoval před 4 roky
Vlastník

But what to do if we know, that spliterator.forEachRemaining is very efficient?

But what to do if we know, that `spliterator.forEachRemaining` is very efficient?
Přihlaste se pro zapojení do konverzace.
Bez milníku
Bez zpracovatele
1 účastníků
Načítání...
Zrušit
Uložit
Není zde žádný obsah.