Optimising multiple streams to single loop Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Effective use of multiple streamsOptimising single-delimiter string tokenisationAdaptive cyclic database iteratorComparing triangles using Java 8 streamsPrinting removed items using lambdas and streamsParsing multiple line records using Java 8 StreamsMandelbrot StreamsNumerical streams exampleJoining a product-application-customer relationship using Java 8 StreamsPython Firewall-Connection-Event Filter too slow
How come Sam didn't become Lord of Horn Hill?
Irreducible of finite Krull dimension implies quasi-compact?
What is the escape velocity of a neutron particle (not neutron star)
On SQL Server, is it possible to restrict certain users from using certain functions, operators or statements?
Can melee weapons be used to deliver Contact Poisons?
Does classifying an integer as a discrete log require it be part of a multiplicative group?
What would be the ideal power source for a cybernetic eye?
What is this building called? (It was built in 2002)
Why wasn't DOSKEY integrated with COMMAND.COM?
Can an alien society believe that their star system is the universe?
Significance of Cersei's obsession with elephants?
Is it common practice to audition new musicians 1-2-1 before rehearsing with the entire band?
How do I find out the mythology and history of my Fortress?
When coming out of haste, do attackers have advantage on you?
Do jazz musicians improvise on the parent scale in addition to the chord-scales?
また usage in a dictionary
How could we fake a moon landing now?
Most bit efficient text communication method?
Maximum summed powersets with non-adjacent items
What's the meaning of "fortified infraction restraint"?
An adverb for when you're not exaggerating
Why aren't air breathing engines used as small first stages
How to answer "Have you ever been terminated?"
Can a new player join a group only when a new campaign starts?
Optimising multiple streams to single loop
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Effective use of multiple streamsOptimising single-delimiter string tokenisationAdaptive cyclic database iteratorComparing triangles using Java 8 streamsPrinting removed items using lambdas and streamsParsing multiple line records using Java 8 StreamsMandelbrot StreamsNumerical streams exampleJoining a product-application-customer relationship using Java 8 StreamsPython Firewall-Connection-Event Filter too slow
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I am trying to find the best way to optimise the converters below to first follow the flow I call convertAndGroupForUpdate
, which triggers the conversions and relevant mappings.
Any help to optimise this code would be massively appreciated.
public List<GroupedOrderActionUpdateEntity> convertAndGroupForUpdate(List<SimpleRatifiableAction> actions)
List<GroupedOrderActionUpdateEntity> groupedActions = new ArrayList<>();
Map<String, List<SimpleRatifiableAction>> groupSimple = actions.stream()
.collect(Collectors.groupingBy(x -> x.getOrderNumber() + x.getActionType()));
groupSimple.entrySet().stream()
.map(x -> convertToUpdateGroup(x.getValue()))
.forEachOrdered(groupedActions::add);
return groupedActions;
public GroupedOrderActionUpdateEntity convertToUpdateGroup(List<SimpleRatifiableAction> actions)
List<OrderActionUpdateEntity> actionList = actions.stream().map(x -> convertToUpdateEntity(x)).collect(Collectors.toList());
return new GroupedOrderActionUpdateEntity(
actions.get(0).getOrderNumber(),
OrderActionType.valueOf(actions.get(0).getActionType()),
actions.get(0).getSource(),
12345,
actions.stream().map(SimpleRatifiableAction::getNote)
.collect(Collectors.joining(", ", "Group Order Note: ", ".")),
actionList);
public OrderActionUpdateEntity convertToUpdateEntity(SimpleRatifiableAction action)
return new OrderActionUpdateEntity(action.getId(), OrderActionState.valueOf(action.getState()));
java performance stream lambda
$endgroup$
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
$begingroup$
I am trying to find the best way to optimise the converters below to first follow the flow I call convertAndGroupForUpdate
, which triggers the conversions and relevant mappings.
Any help to optimise this code would be massively appreciated.
public List<GroupedOrderActionUpdateEntity> convertAndGroupForUpdate(List<SimpleRatifiableAction> actions)
List<GroupedOrderActionUpdateEntity> groupedActions = new ArrayList<>();
Map<String, List<SimpleRatifiableAction>> groupSimple = actions.stream()
.collect(Collectors.groupingBy(x -> x.getOrderNumber() + x.getActionType()));
groupSimple.entrySet().stream()
.map(x -> convertToUpdateGroup(x.getValue()))
.forEachOrdered(groupedActions::add);
return groupedActions;
public GroupedOrderActionUpdateEntity convertToUpdateGroup(List<SimpleRatifiableAction> actions)
List<OrderActionUpdateEntity> actionList = actions.stream().map(x -> convertToUpdateEntity(x)).collect(Collectors.toList());
return new GroupedOrderActionUpdateEntity(
actions.get(0).getOrderNumber(),
OrderActionType.valueOf(actions.get(0).getActionType()),
actions.get(0).getSource(),
12345,
actions.stream().map(SimpleRatifiableAction::getNote)
.collect(Collectors.joining(", ", "Group Order Note: ", ".")),
actionList);
public OrderActionUpdateEntity convertToUpdateEntity(SimpleRatifiableAction action)
return new OrderActionUpdateEntity(action.getId(), OrderActionState.valueOf(action.getState()));
java performance stream lambda
$endgroup$
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
$begingroup$
It should be already fast, without any changes required. some changes might make code cleaner but not faster. Isactions
list fetched from database? Then performance issue might be caused by lazy loading and stackoverflow.com/a/2764474/158037 .
$endgroup$
– user158037
Mar 22 '18 at 13:15
add a comment |
$begingroup$
I am trying to find the best way to optimise the converters below to first follow the flow I call convertAndGroupForUpdate
, which triggers the conversions and relevant mappings.
Any help to optimise this code would be massively appreciated.
public List<GroupedOrderActionUpdateEntity> convertAndGroupForUpdate(List<SimpleRatifiableAction> actions)
List<GroupedOrderActionUpdateEntity> groupedActions = new ArrayList<>();
Map<String, List<SimpleRatifiableAction>> groupSimple = actions.stream()
.collect(Collectors.groupingBy(x -> x.getOrderNumber() + x.getActionType()));
groupSimple.entrySet().stream()
.map(x -> convertToUpdateGroup(x.getValue()))
.forEachOrdered(groupedActions::add);
return groupedActions;
public GroupedOrderActionUpdateEntity convertToUpdateGroup(List<SimpleRatifiableAction> actions)
List<OrderActionUpdateEntity> actionList = actions.stream().map(x -> convertToUpdateEntity(x)).collect(Collectors.toList());
return new GroupedOrderActionUpdateEntity(
actions.get(0).getOrderNumber(),
OrderActionType.valueOf(actions.get(0).getActionType()),
actions.get(0).getSource(),
12345,
actions.stream().map(SimpleRatifiableAction::getNote)
.collect(Collectors.joining(", ", "Group Order Note: ", ".")),
actionList);
public OrderActionUpdateEntity convertToUpdateEntity(SimpleRatifiableAction action)
return new OrderActionUpdateEntity(action.getId(), OrderActionState.valueOf(action.getState()));
java performance stream lambda
$endgroup$
I am trying to find the best way to optimise the converters below to first follow the flow I call convertAndGroupForUpdate
, which triggers the conversions and relevant mappings.
Any help to optimise this code would be massively appreciated.
public List<GroupedOrderActionUpdateEntity> convertAndGroupForUpdate(List<SimpleRatifiableAction> actions)
List<GroupedOrderActionUpdateEntity> groupedActions = new ArrayList<>();
Map<String, List<SimpleRatifiableAction>> groupSimple = actions.stream()
.collect(Collectors.groupingBy(x -> x.getOrderNumber() + x.getActionType()));
groupSimple.entrySet().stream()
.map(x -> convertToUpdateGroup(x.getValue()))
.forEachOrdered(groupedActions::add);
return groupedActions;
public GroupedOrderActionUpdateEntity convertToUpdateGroup(List<SimpleRatifiableAction> actions)
List<OrderActionUpdateEntity> actionList = actions.stream().map(x -> convertToUpdateEntity(x)).collect(Collectors.toList());
return new GroupedOrderActionUpdateEntity(
actions.get(0).getOrderNumber(),
OrderActionType.valueOf(actions.get(0).getActionType()),
actions.get(0).getSource(),
12345,
actions.stream().map(SimpleRatifiableAction::getNote)
.collect(Collectors.joining(", ", "Group Order Note: ", ".")),
actionList);
public OrderActionUpdateEntity convertToUpdateEntity(SimpleRatifiableAction action)
return new OrderActionUpdateEntity(action.getId(), OrderActionState.valueOf(action.getState()));
java performance stream lambda
java performance stream lambda
edited Mar 23 '18 at 18:22
smac89
1,306719
1,306719
asked Mar 22 '18 at 12:21
Kieran WildKieran Wild
91
91
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
$begingroup$
It should be already fast, without any changes required. some changes might make code cleaner but not faster. Isactions
list fetched from database? Then performance issue might be caused by lazy loading and stackoverflow.com/a/2764474/158037 .
$endgroup$
– user158037
Mar 22 '18 at 13:15
add a comment |
1
$begingroup$
It should be already fast, without any changes required. some changes might make code cleaner but not faster. Isactions
list fetched from database? Then performance issue might be caused by lazy loading and stackoverflow.com/a/2764474/158037 .
$endgroup$
– user158037
Mar 22 '18 at 13:15
1
1
$begingroup$
It should be already fast, without any changes required. some changes might make code cleaner but not faster. Is
actions
list fetched from database? Then performance issue might be caused by lazy loading and stackoverflow.com/a/2764474/158037 .$endgroup$
– user158037
Mar 22 '18 at 13:15
$begingroup$
It should be already fast, without any changes required. some changes might make code cleaner but not faster. Is
actions
list fetched from database? Then performance issue might be caused by lazy loading and stackoverflow.com/a/2764474/158037 .$endgroup$
– user158037
Mar 22 '18 at 13:15
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Specifying a downstream Collector
for Collectors.groupingBy
There is an alternative Collectors.groupingBy(Function, Collector)
method that lets you specify further steps that you want to do with the intermediary List<SimpleRatifiableAction>
values after the grouping.
Then, with a bit of renaming, some help from method references, plus some convenience methods like having a SimpleRatifiableAction.getKey()
:
public String getKey()
return getOrderNumber() + getActionType();
You can have a method that reads:
// dropping method visibility modifier for brevity
List<GroupedOrderActionUpdateEntity> process(List<SimpleRatifiableAction> actions)
return new ArrayList<>(actions.stream()
.collect(Collectors.groupingBy(SimpleRatifiableAction::getKey,
Collectors.collectingAndThen(Collectors.toList(),
this::createUpdateEntity)))
.values());
Looping once, aggregating multiple values
Inside convertToUpdateGroup(List)
, now renamed as createUpdateEntity(List)
, you are streaming twice on the List
argument. While this shouldn't be an issue for most cases, there is still an option to just loop once should it be one of the remaining places to optimize (hopefully with some runtime analysis/micro-benchmarking to prove it).
This is achieved by creating the StringJoiner
instance yourself (instead of relying on Collectors.joining()
). To avoid similar List.get(0)
calls, you can also get a reference to it once.
Putting it altogether:
// dropping method visibility modifier for brevity
GroupedOrderActionUpdateEntity createUpdateEntity(List<SimpleRatifiableAction> actions)
SimpleRatifiableAction first = actions.get(0);
StringJoiner joiner = new StringJoiner(", ", "Group Order Note: ", ".");
List<OrderActionUpdateEntity> updateEntities = new ArrayList<>();
actions.forEach(v ->
joiner.add(v.getNote());
updateEntities.add(v.createUpdateEntity());
);
return new GroupedOrderActionUpdateEntity(
first.getOrderNumber(),
OrderActionType.valueOf(first.getActionType()),
first.getSource(),
12345,
joiner.toString(),
updateEntities);
SimpleRatifiableAction.createUpdateEntity()
is also another convenience method that you can consider:
public OrderActionUpdateEntity createUpdateEntity()
return new OrderActionUpdateEntity(getId(), OrderActionState.valueOf(getState()));
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f190198%2foptimising-multiple-streams-to-single-loop%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Specifying a downstream Collector
for Collectors.groupingBy
There is an alternative Collectors.groupingBy(Function, Collector)
method that lets you specify further steps that you want to do with the intermediary List<SimpleRatifiableAction>
values after the grouping.
Then, with a bit of renaming, some help from method references, plus some convenience methods like having a SimpleRatifiableAction.getKey()
:
public String getKey()
return getOrderNumber() + getActionType();
You can have a method that reads:
// dropping method visibility modifier for brevity
List<GroupedOrderActionUpdateEntity> process(List<SimpleRatifiableAction> actions)
return new ArrayList<>(actions.stream()
.collect(Collectors.groupingBy(SimpleRatifiableAction::getKey,
Collectors.collectingAndThen(Collectors.toList(),
this::createUpdateEntity)))
.values());
Looping once, aggregating multiple values
Inside convertToUpdateGroup(List)
, now renamed as createUpdateEntity(List)
, you are streaming twice on the List
argument. While this shouldn't be an issue for most cases, there is still an option to just loop once should it be one of the remaining places to optimize (hopefully with some runtime analysis/micro-benchmarking to prove it).
This is achieved by creating the StringJoiner
instance yourself (instead of relying on Collectors.joining()
). To avoid similar List.get(0)
calls, you can also get a reference to it once.
Putting it altogether:
// dropping method visibility modifier for brevity
GroupedOrderActionUpdateEntity createUpdateEntity(List<SimpleRatifiableAction> actions)
SimpleRatifiableAction first = actions.get(0);
StringJoiner joiner = new StringJoiner(", ", "Group Order Note: ", ".");
List<OrderActionUpdateEntity> updateEntities = new ArrayList<>();
actions.forEach(v ->
joiner.add(v.getNote());
updateEntities.add(v.createUpdateEntity());
);
return new GroupedOrderActionUpdateEntity(
first.getOrderNumber(),
OrderActionType.valueOf(first.getActionType()),
first.getSource(),
12345,
joiner.toString(),
updateEntities);
SimpleRatifiableAction.createUpdateEntity()
is also another convenience method that you can consider:
public OrderActionUpdateEntity createUpdateEntity()
return new OrderActionUpdateEntity(getId(), OrderActionState.valueOf(getState()));
$endgroup$
add a comment |
$begingroup$
Specifying a downstream Collector
for Collectors.groupingBy
There is an alternative Collectors.groupingBy(Function, Collector)
method that lets you specify further steps that you want to do with the intermediary List<SimpleRatifiableAction>
values after the grouping.
Then, with a bit of renaming, some help from method references, plus some convenience methods like having a SimpleRatifiableAction.getKey()
:
public String getKey()
return getOrderNumber() + getActionType();
You can have a method that reads:
// dropping method visibility modifier for brevity
List<GroupedOrderActionUpdateEntity> process(List<SimpleRatifiableAction> actions)
return new ArrayList<>(actions.stream()
.collect(Collectors.groupingBy(SimpleRatifiableAction::getKey,
Collectors.collectingAndThen(Collectors.toList(),
this::createUpdateEntity)))
.values());
Looping once, aggregating multiple values
Inside convertToUpdateGroup(List)
, now renamed as createUpdateEntity(List)
, you are streaming twice on the List
argument. While this shouldn't be an issue for most cases, there is still an option to just loop once should it be one of the remaining places to optimize (hopefully with some runtime analysis/micro-benchmarking to prove it).
This is achieved by creating the StringJoiner
instance yourself (instead of relying on Collectors.joining()
). To avoid similar List.get(0)
calls, you can also get a reference to it once.
Putting it altogether:
// dropping method visibility modifier for brevity
GroupedOrderActionUpdateEntity createUpdateEntity(List<SimpleRatifiableAction> actions)
SimpleRatifiableAction first = actions.get(0);
StringJoiner joiner = new StringJoiner(", ", "Group Order Note: ", ".");
List<OrderActionUpdateEntity> updateEntities = new ArrayList<>();
actions.forEach(v ->
joiner.add(v.getNote());
updateEntities.add(v.createUpdateEntity());
);
return new GroupedOrderActionUpdateEntity(
first.getOrderNumber(),
OrderActionType.valueOf(first.getActionType()),
first.getSource(),
12345,
joiner.toString(),
updateEntities);
SimpleRatifiableAction.createUpdateEntity()
is also another convenience method that you can consider:
public OrderActionUpdateEntity createUpdateEntity()
return new OrderActionUpdateEntity(getId(), OrderActionState.valueOf(getState()));
$endgroup$
add a comment |
$begingroup$
Specifying a downstream Collector
for Collectors.groupingBy
There is an alternative Collectors.groupingBy(Function, Collector)
method that lets you specify further steps that you want to do with the intermediary List<SimpleRatifiableAction>
values after the grouping.
Then, with a bit of renaming, some help from method references, plus some convenience methods like having a SimpleRatifiableAction.getKey()
:
public String getKey()
return getOrderNumber() + getActionType();
You can have a method that reads:
// dropping method visibility modifier for brevity
List<GroupedOrderActionUpdateEntity> process(List<SimpleRatifiableAction> actions)
return new ArrayList<>(actions.stream()
.collect(Collectors.groupingBy(SimpleRatifiableAction::getKey,
Collectors.collectingAndThen(Collectors.toList(),
this::createUpdateEntity)))
.values());
Looping once, aggregating multiple values
Inside convertToUpdateGroup(List)
, now renamed as createUpdateEntity(List)
, you are streaming twice on the List
argument. While this shouldn't be an issue for most cases, there is still an option to just loop once should it be one of the remaining places to optimize (hopefully with some runtime analysis/micro-benchmarking to prove it).
This is achieved by creating the StringJoiner
instance yourself (instead of relying on Collectors.joining()
). To avoid similar List.get(0)
calls, you can also get a reference to it once.
Putting it altogether:
// dropping method visibility modifier for brevity
GroupedOrderActionUpdateEntity createUpdateEntity(List<SimpleRatifiableAction> actions)
SimpleRatifiableAction first = actions.get(0);
StringJoiner joiner = new StringJoiner(", ", "Group Order Note: ", ".");
List<OrderActionUpdateEntity> updateEntities = new ArrayList<>();
actions.forEach(v ->
joiner.add(v.getNote());
updateEntities.add(v.createUpdateEntity());
);
return new GroupedOrderActionUpdateEntity(
first.getOrderNumber(),
OrderActionType.valueOf(first.getActionType()),
first.getSource(),
12345,
joiner.toString(),
updateEntities);
SimpleRatifiableAction.createUpdateEntity()
is also another convenience method that you can consider:
public OrderActionUpdateEntity createUpdateEntity()
return new OrderActionUpdateEntity(getId(), OrderActionState.valueOf(getState()));
$endgroup$
Specifying a downstream Collector
for Collectors.groupingBy
There is an alternative Collectors.groupingBy(Function, Collector)
method that lets you specify further steps that you want to do with the intermediary List<SimpleRatifiableAction>
values after the grouping.
Then, with a bit of renaming, some help from method references, plus some convenience methods like having a SimpleRatifiableAction.getKey()
:
public String getKey()
return getOrderNumber() + getActionType();
You can have a method that reads:
// dropping method visibility modifier for brevity
List<GroupedOrderActionUpdateEntity> process(List<SimpleRatifiableAction> actions)
return new ArrayList<>(actions.stream()
.collect(Collectors.groupingBy(SimpleRatifiableAction::getKey,
Collectors.collectingAndThen(Collectors.toList(),
this::createUpdateEntity)))
.values());
Looping once, aggregating multiple values
Inside convertToUpdateGroup(List)
, now renamed as createUpdateEntity(List)
, you are streaming twice on the List
argument. While this shouldn't be an issue for most cases, there is still an option to just loop once should it be one of the remaining places to optimize (hopefully with some runtime analysis/micro-benchmarking to prove it).
This is achieved by creating the StringJoiner
instance yourself (instead of relying on Collectors.joining()
). To avoid similar List.get(0)
calls, you can also get a reference to it once.
Putting it altogether:
// dropping method visibility modifier for brevity
GroupedOrderActionUpdateEntity createUpdateEntity(List<SimpleRatifiableAction> actions)
SimpleRatifiableAction first = actions.get(0);
StringJoiner joiner = new StringJoiner(", ", "Group Order Note: ", ".");
List<OrderActionUpdateEntity> updateEntities = new ArrayList<>();
actions.forEach(v ->
joiner.add(v.getNote());
updateEntities.add(v.createUpdateEntity());
);
return new GroupedOrderActionUpdateEntity(
first.getOrderNumber(),
OrderActionType.valueOf(first.getActionType()),
first.getSource(),
12345,
joiner.toString(),
updateEntities);
SimpleRatifiableAction.createUpdateEntity()
is also another convenience method that you can consider:
public OrderActionUpdateEntity createUpdateEntity()
return new OrderActionUpdateEntity(getId(), OrderActionState.valueOf(getState()));
answered Mar 23 '18 at 16:15
h.j.k.h.j.k.
18.2k32990
18.2k32990
add a comment |
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f190198%2foptimising-multiple-streams-to-single-loop%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
It should be already fast, without any changes required. some changes might make code cleaner but not faster. Is
actions
list fetched from database? Then performance issue might be caused by lazy loading and stackoverflow.com/a/2764474/158037 .$endgroup$
– user158037
Mar 22 '18 at 13:15