<p>Hey all,
I'm learning golang and I made a little art project using quad trees. Check it out <a href="https://github.com/bradymadden97/go-quads">https://github.com/bradymadden97/go-quads</a>.</p>
<hr/>**评论:**<br/><br/>Kraigius: <pre><p>Your project is difficult to setup but it's easy to fix.</p>
<p>You should probably vendor or at the strict minimum list your go dependencies. I would recommend that you document that python can be used to <em>enhance</em> the program to allow gif creation, it's not required strictly speaking for the program to function and it just adds more dependencies (bash and python aren't standard on windows ;) ). You should also document where we should put that python script. Looking at the code it seems to only look in the local directory but in my case I build the executable somewhere else and the script remained in the <code>quads/</code> folder. There's also an error in your requirements file as it requires double equals.</p>
<p>As a last note, and this is more about the code itself, check that the <code>.out</code> folder exists and create it if it doesn't. I thought your program wasn't working until I peaked in the code and realized that I needed that folder. The default iteration is 20 and not 200 ;)</p>
<p>It works great though!</p></pre>birkbork: <pre><blockquote>
<p>You should probably vendor or at the strict minimum list your go dependencies.</p>
</blockquote>
<p>If you are unsure about what dependencies a project needs, let go figure it out for you:</p>
<p>In the project root:</p>
<pre><code>go get -v -u -t ./...
</code></pre>
<p>-v is verbose, to show what packages are pulled</p>
<p>-u updates packages already in your go/src tree</p>
<p>-t also pulls packages only used in *_test.go files</p>
<p>and ./... travels the directory hierarchy</p>
<pre><code>go help get
</code></pre>
<p>for more info!</p></pre>bmadden19: <pre><p><code>vendor</code> is inside <code>/quads</code></p></pre>birkbork: <pre><p>Yes, I found it. Was just adding some useful info in reply to <a href="/u/Kraigius" rel="nofollow">/u/Kraigius</a></p></pre>Kraigius: <pre><p>Thanks but it's not just knowing the dep but also locking it to a specific version (or taking note of that version) otherwise your project can silently break at any moment.</p></pre>bmadden19: <pre><p>Thanks for your help! This is one of my first go projects/ projects used by os community so the setup steps definitely need some tweaking and feedback.</p></pre>Kraigius: <pre><p>I didn't just complained, I also sent some PR love in your way :)</p></pre>Baratock: <pre><p>separating the application from the quad-generating library would be great.</p>
<p>Then you can try to use your quadgenerator as a library for another application.</p></pre>puffybunion: <pre><p>Nice! Really like the results. Do you mind sharing a bit about the algorithm you use? Also, mind talking about the performance, i.e, how long it takes to generate an image?</p></pre>FogleMonster: <pre><p>The algorithm is briefly explained on my page here:</p>
<p><a href="https://www.michaelfogleman.com/static/quads/">https://www.michaelfogleman.com/static/quads/</a></p></pre>puffybunion: <pre><p>Holy shit, it's Fogleman! I love your work, dude.</p></pre>FogleMonster: <pre><p>Haha, thanks!</p></pre>bmadden19: <pre><p>Wow! Didn't expect this at all. Definitely all the credit to you for the idea - I thought it was so cool I had to see if I could do it myself!</p></pre>bmadden19: <pre><p>Just from some quick trials on my computer:
Small image (512x512 px)
250 iterations: 1 s;
1000 iterations: 2.3 s</p>
<p>Larger image (2048x2048 px)
250 iterations: 17 s;
1000 iterations: 45 s</p>
<p>Maybe @FogleMonster could share how long his Python version takes in comparison</p></pre>int32_t: <pre><p>Perhaps you can add a benchmark using the <code>testing</code> package so that it can be done simply by <code>go test -bench ...</code>. (Also a good exercise about the idiomatic testing if you're learning Go)</p></pre>FogleMonster: <pre><p>512x512, 1000 iterations: 1.7 seconds
2048x2048, 1000 iterations: 2.1 seconds</p></pre>