> On March 21, 2016, 2:02 p.m., Joris Van Remoortere wrote: > > src/common/values.cpp, line 613 > > <https://reviews.apache.org/r/43561/diff/3/?file=1273811#file1273811line613> > > > > @benm I wish we had support for iterating over these splicers eg: > > `foreachtoken(temp, ",\n", [](const string& token) { ... });` > > > > These helpers become rather heavy (at 3 nested) considering their > > utility. > > Klaus Ma wrote: > @joris, I think `foreachtoken` is also nested loop. When doing the > patches, there're three options to me: FSM, regex and nested loop; FSM & > regex seems hard to maintain, so I used nested loop. > > Klaus Ma wrote: > `foreachtoken(temp, ",\n", [](const string& token) { ... });` is a good > helper function; but no performance improvement. Any comments? > > Klaus Ma wrote: > @joris, I logged MESOS-5234 to trace this; I'll update patches > accordingly. > > Klaus Ma wrote: > @joris, had a patch for `foreachtoken`; would you help to review it? > > https://reviews.apache.org/r/46425/
Joris why not do this? ``` foreach (const string& token, strings::token(s, ",")) { ... } ``` By the way, we're cleaning up this code in https://reviews.apache.org/r/49223/ and other patches. This patch should become trivial. - Benjamin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/43561/#review124545 ----------------------------------------------------------- On June 11, 2016, 2:29 p.m., Klaus Ma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/43561/ > ----------------------------------------------------------- > > (Updated June 11, 2016, 2:29 p.m.) > > > Review request for mesos, Alexander Rukletsov, Benjamin Mahler, and Joris Van > Remoortere. > > > Bugs: MESOS-4627 > https://issues.apache.org/jira/browse/MESOS-4627 > > > Repository: mesos > > > Description > ------- > > Improve Ranges parsing to handle single values. > > > Diffs > ----- > > src/common/values.cpp 587cb68551d438621e215953e89818b623b7f71b > src/tests/values_tests.cpp 929861549e3155c33966896f817f9bf9e6d14354 > > Diff: https://reviews.apache.org/r/43561/diff/ > > > Testing > ------- > > make > make check GTEST_FILTER=~"*" > ./src/mesos-test > > > Thanks, > > Klaus Ma > >