Mir Blog: Writing efficient numerical code in D
Andrei Alexandrescu via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Dec 12 21:27:01 PST 2016
On 12/12/16 4:58 PM, Relja Ljubobratovic wrote:
> Hey guys,
>
> We have just published another post on "Writing efficient numerical code
> in D", to Mir's Blog[1]. In this post we are focusing on
> mir.ndslice.algorithm usage in DCV[2], computer vision library that has
> recently joined libmir organization. We've had great success in
> optimizing DCV's algorithms mostly by replacing loop-style code with
> mir.ndslice.algorithm multidimensional iteration utilities[3], and we
> thought it was worth blogging about.
>
> Any grammar (or any other type of) fix report is greatly appreciated!
>
> Also, we'd like to ask Mike Parker to forward this to reddit if it's not
> too much trouble? :) Maybe only wait few days so we could weed out some
> mistakes from the text.
>
> Cheers,
> Relja
>
> [1]
> http://blog.mir.dlang.io/ndslice/algorithm/optimization/2016/12/12/writing-efficient-numerical-code.html
>
> [2] https://github.com/libmir/dcv
> [3] https://github.com/libmir/dcv/pull/58
This is awesome! Mike, could you please post to reddit about 11 hours
from now if possible.
I'm about to fall asleep, but I made a quick pass through the piece.
Here are a few nits:
* "In this post I’d like give" -> "This post gives"
* "module equipped with" -> "module that provides"
* "it’s usage" -> "its usage"
* "Note: It is assumed the reader is already somewhat familiar with
ndslice package [1]." -> "This article assumes the reader has a cursory
understanding of the ndslice package. If not, please consult this
post/doc/webpage/etc before returning here."
* "What does it offer?" -> "What does mir.ndslice.algorithm offer?"
* "its integrated seamlessly" -> "it is integrated seamlessly"
* "by that allowing more natural flow of processing pipeline" -> "which
makes for elegantly flowing processing pipelines"
* "One of key components to make code based" -> "One key component that
makes code based"
* "LLVM based D compiler" -> "the LLVM based D compiler"
* "kernels you write" -> "computation kernels written by the end user"
* "else turned on" -> "turned on"
* ", by Johan Engelen" -> remove the comma
* "we’ve been actively refactoring" -> define the team; so far the
article referred to the author as a single person
* "with mir.ndslice.algorithm equivalent" -> "with mir.ndslice.algorithm
equivalents"
* align numbers in html tables to the right
* "As you can see, speedups" -> "Speedups"
* "as I’ll show you in this post" -> "as shown below"
* "take a look at PR" -> "take a look at the pull request"
* "Discalmer" -> "Disclaimer"
* "mind DCV project" -> "mind the DCV project"
* "showing power" -> "showing the power"
* "dive into implementation" -> "dive into the implementation"
* "without extensive optimization techniques applied" -> "without
extensive optimizations"
* "In future we’ll focus" -> "A future post will focus"
* "first we’ll take a look" -> "first let's take a look"
* "basic principle how it can efficiently replace loop-based code" ->
"basic principle of replacing loop-based code with pipelines efficiently"
* "… This code" -> "This code"
* "apply given kernel" -> "apply the given kernel"
* "To bring this example more down to earth" -> "To make the example
more concrete"
* "As you can see, we are replacing" -> "The pipeline version replaces"
* "with few magic calls" -> "with a few magic calls"
* "And as you may have noticed, at" -> "At"
* "I get ~10x speedup" -> there's been a bunch of "we" and now getting
back to "I" is surprising. You may want to make a pass making sure the
use of person is consistent.
* "that variant written" -> "that the variant written"
* "syntax, and are" -> "syntax and are"
* "this is most basic binarization" -> "this is a most basic binarization"
* "Special part to care about, related to lockstep, is that byElement
call on each input Slice" -> "The call to byElement inside lockstep is
worth special attention"
* "We can notice right away there’s a change" -> "First off, there's a
change"
* "requires this so" -> "assumes that is the case"
* "We can also notice byElement" -> "Notably, byElement"
* "examine performance differences" -> "compare the impact of these
changes on performance"
* "On my machine" -> "On a Core i7 laptop with xyz GB or RAM and xyz
other relevant parameters..."
* "result is following" -> "the results are as follows"
* "with very little effort using" -> "with very little effort by using"
* "and it’s submodules" -> "and its submodules"
* "coming for some numerical computing" -> "having an interest in
numerical computing"
* "would have to be introduced to ndslice" -> "should take a close look
at ndslice"
I suggest making two passes through the piece: (a) one pass should
reduce fillers that are abundant ("as you can see", "as I'll show you",
"as said in the docs"...) A few are fine (perhaps 2-3 in the whole
article. Then (b) one pass looking for unified use of "I" (most likely:
the author, use sparingly), "you" (the reader, use sparingly), and "we"
(most likely: the author and reader looking together at something).
The results are terrific, congrats Ilya and Relja!
Andrei
More information about the Digitalmars-d-announce
mailing list