-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeed.xml
843 lines (674 loc) · 57.3 KB
/
feed.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Adhityaa's blog</title>
<description>Adhityaa's blog
</description>
<link>http://hypothesist.github.io/</link>
<atom:link href="http://hypothesist.github.io/feed.xml" rel="self" type="application/rss+xml"/>
<pubDate>Mon, 15 Aug 2016 22:23:44 +0530</pubDate>
<lastBuildDate>Mon, 15 Aug 2016 22:23:44 +0530</lastBuildDate>
<generator>Jekyll v3.1.3</generator>
<item>
<title>GSoC '16: Final Report</title>
<description><p>GSoC 2016 was one of the best things I&#39;ve had the opportunity to participate in. I&#39;ve learned so much, had a lot of fun with the community the whole time, got to work on something that I really like and care about, got the once-in-a-lifetime opportunity to visit Europe, and still get paid in the end. And none of this would have been possible without the support and help from the coala community as a whole. Especially Lasse, who was my mentor for the program, from whom I&#39;ve learned
so, so much. And Abdeali, who introduced me to coala in the first place and help me get settled in the community. It honestly wouldn&#39;t have been possible without any of them, and I really mean it. Seriously, thank you :)</p>
<h4>List of commits I&#39;ve made over the summer</h4>
<p>The last three months have been action packed. Check &#39;em out for yourself:</p>
<p><a href="https://github.com/coala-analyzer/coala-quickstart"><code>coala-quickstart</code></a></p>
<table><thead>
<tr>
<th>Commit SHA</th>
<th>Commit</th>
</tr>
</thead><tbody>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/b8d8349a72247343e2beb1d906ddb41cc2b476e4"><code>b8d8349</code></a></td>
<td>Add tests directory for testing</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/df99516e5b7978aa30a07b59f74c93ec1acfe8c4"><code>df99516</code></a></td>
<td>py.test: Execute doctests for all modules</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/3d01aed917ecbc13016058131be22062e2ff7816"><code>3d01aed</code></a></td>
<td>Create coala-quickstart executable</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/28a33f9c2c1ac4f3532872d15a09ba54ebe9a6e6"><code>28a33f9</code></a></td>
<td>Add coala bear logo with welcome message</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/759e445f6e36237527d4bcd538db591da17a1bdb"><code>759e445</code></a></td>
<td>generation: Add validator to ensure path is valid</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/111d9844c5c8f077fa8d7c930c096aea4ac970f6"><code>111d984</code></a></td>
<td>generation: Identify most used languages</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/4ace132ccd75148df42d7395d2e3e1ef67a4f742"><code>4ace132</code></a></td>
<td>generation: Ask about file globs</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/8f7fe23931b8672147d7e04f24ddf8a4ea6751fd"><code>8f7fe23</code></a></td>
<td>generation: Identify relevant bears and show help</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/839fa195102d0d40a185738f23c718127cd41c7d"><code>839fa19</code></a></td>
<td>FileGlobs: Simplify questions</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/7c98e485df04a2ad4ef644e3fb5b675d7d5e0931"><code>7c98e48</code></a></td>
<td>Settings: Generate sections for each language</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/b28e20c3c6b3b4aa61062d59640b762c64e0645e"><code>b28e20c</code></a></td>
<td>Settings: Write to coafile</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/69a5d2feb49fb777e6bd80442fe69a107f5ebf7e"><code>69a5d2f</code></a></td>
<td>Generate coafile with basic settings</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/60bee9a7c8c8618e6314749d2a85568659b0bed4"><code>60bee9a</code></a></td>
<td>Extract files to ignore from .gitignore</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/62978adf4cd0ef902ca0c1fc89fa88837e815e1c"><code>62978ad</code></a></td>
<td>Change requirements</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/36c848632a846052191b6d1d50df948741632a82"><code>36c8486</code></a></td>
<td>Enable coverage report</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/d78e85ed94f6d307e55b0546427b94ca5d0434f5"><code>d78e85e</code></a></td>
<td>Bears: Change language used in tests</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/4a8819e1e70a1e99aeef4ab910bf2201033e2637"><code>4a8819e</code></a></td>
<td>setup.py: Add myself to the list of maintainers</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/54f21c6b9bf67e4fb0c6be33cfb4398d69650338"><code>54f21c6</code></a></td>
<td>gitignore: Ignore .egg-info directories</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala-quickstart/commit/6a7b63a61804fca774c73d20316138e92a6451f7"><code>6a7b63a</code></a></td>
<td>Bears: Use only important bears for each language</td>
</tr>
</tbody></table>
<p><a href="https://github.com/coala-analyzer/coala"><code>coala</code></a></p>
<table><thead>
<tr>
<th>Commit SHA</th>
<th>Commit</th>
</tr>
</thead><tbody>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/45bfec9472a6166d99464ab2472a1d8707985cd6"><code>45bfec9</code></a></td>
<td>Processing: Reuse file dicts loaded to memory</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/ef287a46aabab3dcd67e9bfc3395e47001ef0c39"><code>ef287a4</code></a></td>
<td>ConsoleInteraction: Sort questions by bear</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/7d57784e0fd0f09ca36815b53498475713129420"><code>7d57784</code></a></td>
<td>Caching: Make caching default</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/173281382071c4fb660457c100aa03c52b6fbc52"><code>1732813</code></a></td>
<td>Processing: Switch log message to debug</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/01890c2b6288a8ed78c7d5a167a796164884b38b"><code>01890c2</code></a></td>
<td>CachingUtilitiesTest: Use <code>Section</code></td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/868c926a4e24259e7f1224a6a0671d6b82f25b39"><code>868c926</code></a></td>
<td>README: Update it</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/f79f53e51079085fc0abb5e0c7b0577133833758"><code>f79f53e</code></a></td>
<td>Constants: Add strings to binary answers</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/2d7ee93d4b8693b2a37c927813aba643d0ffdc6b"><code>2d7ee93</code></a></td>
<td>LICENSE: Remove boilerplate stuff</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/da6c3ebdf7034a13dc31400750006a815c4c2de6"><code>da6c3eb</code></a></td>
<td>Replace listdir with scandir</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/ad3ec72ac44ee27926fa063e1173f515c1546951"><code>ad3ec72</code></a></td>
<td>coalaCITest: Remove unused imports</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/91c109d2910866c95ef48c9dd6c10ecbc8f99f58"><code>91c109d</code></a></td>
<td>Add option to run coala only on changed files</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/5a6870c89ede45cbe21c77120d95f1bd9bee17a3"><code>5a6870c</code></a></td>
<td>coala: Add class to collect only changed files</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/622a3e5552e90983499ad182eb8c1ff347c183d1"><code>622a3e5</code></a></td>
<td>Add caching utilities</td>
</tr>
<tr>
<td><a href="https://github.com/coala-analyzer/coala/commit/e1b3594b06a0b8c73f23de9a1c8c8ebd8e76f607"><code>e1b3594</code></a></td>
<td>Tagging: Remove Tagging</td>
</tr>
</tbody></table>
<p><a href="https://gitlab.com/coala/coala-utils/"><code>coala-utils</code></a></p>
<table><thead>
<tr>
<th>Commit SHA</th>
<th>Commit</th>
</tr>
</thead><tbody>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/27ee83cdbae88a24d99c42421e41d4e7808a545b"><code>27ee83c</code></a></td>
<td>Update version</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/64b0e0b57d70f6dbd05f05175c02bf7be40737fc"><code>64b0e0b</code></a></td>
<td>Question: Validate the answer</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/1046c2960bc1f1309a21eb09c94d1386656dec69"><code>1046c29</code></a></td>
<td>VERSION: Bump version</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/bd1e8faf1e6a0dd44387c1ecb390c33e5d8fc011"><code>bd1e8fa</code></a></td>
<td>setup.cfg: Enable coverage report</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/79fee96a8381852f05b87092d40a36e7e900c592"><code>79fee96</code></a></td>
<td>Question: Use <code>input</code> instead of prompt toolkit</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/cfd81c17d4724b1117a96e86bd3296e56f93fcc0"><code>cfd81c1</code></a></td>
<td>coala_utils: Move <code>ContextManagers</code> from coalib</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/c5a4526e73902456d571bdbb63a4272a1a84a70d"><code>c5a4526</code></a></td>
<td>Add MANIFEST</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/f0199620fda9ae1bf64fe5a14868cd05de776755"><code>f019962</code></a></td>
<td>Change VERSION</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/9db2898c48b9260e7be67e7e0dcc1641c9ef40fa"><code>9db2898</code></a></td>
<td>Add map between file extension to language name</td>
</tr>
<tr>
<td><a href="https://gitlab.com/coala/coala-utils/commit/a52a30983487d457f7c6b3c0db0741c59b5681db"><code>a52a309</code></a></td>
<td>coala_utils: Add Question module</td>
</tr>
</tbody></table>
<p>That&#39;s a <b><font color="green">+2633</font> / <font color="red">-471</font></b> change! I honestly didn&#39;t know it&#39;d be
that big. Anyway, those were the technical stats. On to the showcase!</p>
<h4>Stuff I worked on</h4>
<h5>My primary GSoC proposal: <code>coala-quickstart</code></h5>
<p><blockquote class="imgur-embed-pub" lang="en" data-id="a/I5VEw"><a href="//imgur.com/I5VEw">coala-quickstart</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script></p>
<p>And here&#39;s the coafile that&#39;s generated:</p>
<script src="https://gist.github.com/hypothesist/8cafb300ae3c9c7905fdc8b6bce8ae43.js"></script>
<p>Pretty neat stuff, huh? :)</p>
<p>Anyway, that was my whole project in a nutshell. I worked on other stuff too during the coding period. Here are some of the results:</p>
<h5>Caching in <code>coala</code></h5>
<p>This is another thing I&#39;m proud of: caching in coala. Remember how you had to lint all your files every time even if you changed just one line? No more. With caching, coala will only collect those files that have changed since the last run. This produces a terrific improvement in speed:</p>
<table><thead>
<tr>
<th></th>
<th>Trial 1</th>
<th>Trial 2</th>
<th>Trial 3</th>
<th>Average</th>
</tr>
</thead><tbody>
<tr>
<td>Without caching</td>
<td>9.841</td>
<td>9.594</td>
<td>9.516</td>
<td>9.650</td>
</tr>
<tr>
<td>With caching</td>
<td>3.374</td>
<td>3.341</td>
<td>3.358</td>
<td>3.358</td>
</tr>
</tbody></table>
<p>That&#39;s almost a 3x improvement in speed!</p>
<p>Initially, caching was an experimental feature since we didn&#39;t want to break stuff! And this <em>can</em> break a lot of stuff. But fortunately, everything went perfectly smoothly and caching was made default.</p>
<h5>README overhaul</h5>
<p>The <a href="https://github.com/coala-analyzer/coala/blob/master/README.rst">coala README page</a> got a
complete overhaul. I placed a special emphasis on simplicity and the design; and to be honest,
I&#39;m quite happy with the outcome.</p>
<h5>Other miscellaneous stuff</h5>
<p>I worked on other tiny things during the coding phase:</p>
<ul>
<li><a href="https://github.com/coala-analyzer/coala/pull/2585">#2585</a>: This was a small bugfix (to my annoyance, introduced by me). This also led to a performance improvement.</li>
<li><a href="https://github.com/coala-analyzer/coala/pull/2322">#2322</a>: <code>listdir</code> is a new <code>python3.5</code> feature that is faster than the traditional <code>scandir</code> that is used to get a directory&#39;s contents.</li>
<li><a href="https://github.com/coala-analyzer/coala/commit/e1b3594b06a0b8c73f23de9a1c8c8ebd8e76f607"><code>e1b3594</code></a>: I removed <code>Tagging</code> with this commit. It was unused.</li>
<li><a href="https://gitlab.com/coala/coala-utils/merge_requests/11">#11</a>, <a href="https://gitlab.com/coala/coala-utils/merge_requests/14">#14</a>: A generic tool to ask the user a question and return the answer in a formatted manner. This is now used in several packages across coala.</li>
</ul>
<p>There were other tiny changes, but you can find them in the commit list.</p>
<h4>Conclusion</h4>
<p>It&#39;s really been a blast, right from the start to the start to the finish. Thanks to everyone who has helped me in any way. Thanks to Google for sponsoring such an awesome program. Thanks to the PSF for providing coala with an opportunity at GSoC. I honestly can&#39;t see how this would have been possible without any of you.</p>
<p>To everyone else, I really recommend contributing to open-source. It doesn&#39;t have to be coala. It doesn&#39;t even need to be a big project. Just find a project you like: it can even be a silly project that doesn&#39;t do anything useful. The whole point is to get started. GSoC is one way to easily do that. There is such a wide variety of organizations and projects, I&#39;m pretty sure at least one project will be to your liking. And you&#39;re always welcome at coala. Just drop by and
say hello at <a href="https://gitter.im/coala-analyzer/coala">our Gitter channel</a>.</p>
<p>Adhityaa</p>
</description>
<pubDate>Mon, 15 Aug 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/08/15/gsoc-final-post.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/08/15/gsoc-final-post.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>GSoC '16: Update</title>
<description><p>Hello again!</p>
<p>Big advancements and changes for this update.</p>
<p>I have almost got my whole project merged! It is in the very last stages with one or two tiny changes to make and then it&#39;s done!</p>
<p>There have been a few changes design-wise:</p>
<ul>
<li><p>The number of questions has been reduced to just one: this is the ultimate quickstart setup. You just need to give the project directory now and the coafile will be automatically generated. No interaction from the user at all!<br>
Basically, the question asking the user for files to match is now everything by default. And the files to ignore is automatically identified from the gitignore file. Pretty neat huh?</p></li>
<li><p>No more complicated section globs. Instead of having an unnecessarily long section, we&#39;re now generating concise globs that virtually do the same thing.</p></li>
<li><p>Settings filling: instead of leaving the mandatory settings to be asked for at runtime, we&#39;re now prompting the user for the values at coafile generation itself. This is more logical.</p></li>
</ul>
<p>Here&#39;s the coafile generated when I ran coala-quickstart on coala-quickstart&#39;s project directory:</p>
<div class="highlight"><pre><code class="language-" data-lang="">[default]
bears = LineLengthBear, LineCountBear, SpaceConsistencyBear, InvalidLinkBear, KeywordBear, FilenameBear
files = **.py, **.yml, **.rst, **.c, **.js
ignore = .git/**, **/build/**, **/htmlcov/**, htmlcov/**, **/src/**
max_lines_per_file = 1000
use_spaces = True
cs_keywords, ci_keywords =
[python]
bears = CPDBear, PyCommentedCodeBear, RadonBear, PyUnusedCodeBear, PEP8Bear, PyImportSortBear, PyDocStyleBear, PyLintBear
files = **.py
language = python
[yaml]
bears = YAMLLintBear
files = **.yml
[restructuredtext]
bears = reSTLintBear
files = **.rst
[c]
bears = GNUIndentBear, ClangASTPrintBear, CPPCheckBear, CSecurityBear, ClangBear, ClangComplexityBear
files = **.c
[javascript]
bears = CPDBear, ESLintBear, JSComplexityBear, JSHintBear
files = **.js
language = python
</code></pre></div>
<p>I really like this: this was how I envisioned the coafile to look like originally and it&#39;s panning out even better.</p>
<p>I&#39;m now in the last week of my project. I&#39;m expecting the PR to be merged today and then I&#39;ll be focussing on the prototype I have for guessing each bear&#39;s params. I&#39;ll make an update post again next week.</p>
<p>Till then,<br>
Adhitya </p>
</description>
<pubDate>Mon, 08 Aug 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/08/08/gsoc-update.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/08/08/gsoc-update.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>My EuroPython Experience</title>
<description><p><img src="https://ep2016.europython.eu/static/p6/images/europython-2016-logo-white-bg.png" alt="EuroPython 2016"></p>
<p>What a blast! I had a lot of fun at EuroPython, and it wasn&#39;t just the conference.</p>
<p>To start off, it was exciting to meet the guys: Lasse, Max, Tushar, Udayan, Adrian, Alex and Justus. My only interaction with them was through Gitter previously. We had a lot of fun (more on that later): everyday after the conference, we all go over to the Airbnb and do our own sprints which I enjoyed from start to finish.</p>
<p>And the conference itself was one of the best experiences I&#39;ve ever had: I learned <em>so</em> much about Python: iterables, meta-classes, performance optimizations, parallel computing and much, much more.</p>
<p>But my favorites were the Lightning Talks. A Lightning Talk is an hour long event where several speakers get five minutes on stage to talk about virtually anything they want. Lasse got two opportunities on stage and Max gave a talk as well. And then on the last day, the whole team got to present a video, which we made the night before. It is one of the most hilarious things I&#39;ve seen :D</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/JWVCMjKU_10" frameborder="0" allowfullscreen></iframe>
<p>I also had the opportunity to co-conduct a 3-hour workshop on making a contribution to open source with Tushar. It was an interesting experience and I never fully understood the amount of effort that needs to go into a talk/workshop till then.</p>
<p>And on the last two days, we had sprints. I just juggled with several small issues and PRs (and of course, my GSoC project). It was different talking in person with everybody instead of Gitter (although we did use Gitter when the person was over 3 feet away :P). And we got a lot of stuff done (and I got a bar of chocolate from Lasse!).</p>
<p>Anyway, that was my EuroPython experience. I went on a tour to France, Belgium and Poland after that for a week: Europe is truly beautiful. Hope I can make it next year as well :)</p>
<p>Adhityaa<br>
<code>:wq</code></p>
</description>
<pubDate>Sat, 06 Aug 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/08/06/europython-update.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/08/06/europython-update.html</guid>
<category>GSOC</category>
<category>coala</category>
<category>europython</category>
</item>
<item>
<title>GSoC '16: Weeks 5-7 updates</title>
<description><p>This week was admittedly slow. I have been a bit pre-occupied with a couple of
other things, including EuroPython preparation. But a huge chunk is already completed, so
I guess that gives me a little cushion :)</p>
<p>The <code>coala-quickstart</code> pull request is still under review - it is an incredibly big thing with
over 1000+ lines of code spread out over ~16 commits, so it&#39;s understandable. Big
props to <a href="https://github.com/sils1297">Lasse</a> for taking the time to patiently
review it.</p>
<p>Two (major) developments in this period:</p>
<ul>
<li><a href="https://gitlab.com/coala/coala-utils/"><code>coala-utils</code></a> - this is a utility
package that is designed to contain various small helper modules that can be
used globally by coala (and everyone else!).<br></li>
</ul>
<p>It is currently just a collection of tools sourced around from various sections
in the coala-analyzer, but it has so much scope for expansion.</p>
<p>The idea behind this partitioning is
that a there are other coala projects under construction by other (awesome)
GSoCers and code redundancy is an evil. Another side benefit is the removal of
possible cyclic reference issues between these tools and <code>coalib</code>.</p>
<ul>
<li>I&#39;ve also been working on an enhancement for the <a href="https://github.com/coala-analyzer/coala/blob/836832970c0d54ab7ae558d4ca412eee9167fd78/README.rst">current README file</a>. You can
follow the progress at my <a href="https://github.com/coala-analyzer/coala/pull/2413">pull request #2413</a>.</li>
</ul>
<p>There was a challenge I was not able to overcome: integration of <a href="https://github.com/jonathanslenders/python-prompt-toolkit"><code>prompt-toolkit</code></a>
with <code>pytest</code>. After much effort (and believe me, I spent a full day looking at
3-4 lines of code), I gave up. The gist of the issue is that <code>pytest</code> attempts some
magic with <code>import</code>s. I have a suspicion this is for coverage, but I may be wrong
here. Anyway, this messes with <code>prompt-toolkit</code>s imports and the whole thing breaks.</p>
<p>So I had to fallback to the rudimentary <code>input()</code> method instead for the implmentation
of <a href="https://gitlab.com/coala/coala-utils/blob/master/coala_utils/Question.py"><code>ask_question</code></a>.While <code>prompt-toolkit</code>
is really fancy and has a ton of amazing features, tests are more
important. So we chose <code>pytest</code>, but I really hope I can find the time to change the
module to use <code>prompt-toolkit</code> in the future.</p>
<p>Anyway, that was that.</p>
<p>Adhityaa</p>
<p><code>:wq</code></p>
</description>
<pubDate>Wed, 13 Jul 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/07/13/gsoc-16-coala-week-6.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/07/13/gsoc-16-coala-week-6.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>EuroPython!</title>
<description><p><img src="https://ep2016.europython.eu/static/p6/images/europython-2016-logo-white-bg.png" alt="EuroPython 2016"></p>
<p>I&#39;ll be going to <a href="https://ep2016.europython.eu/en/">EuroPython 2016</a> this week! I can&#39;t
even begin to describe how ecstatic I am!</p>
<p>It&#39;s going to be held in <strong>Bilbao, Spain</strong> - a truly beautiful city, I&#39;ve heard. I&#39;m also
delighted to say I&#39;ve been sponsored full accommodation by the wonderful folks at
EuroPython.</p>
<p>I&#39;ll be holding a <a href="https://ep2016.europython.eu/conference/talks/guid-to-make-a-real-contribution-to-an-open-source-project-for-novice">workshop on Git and other things</a> along with <a href="http://gtushar.co/">Tushar</a>
a fellow GSoCer at coala. If you&#39;ll be around, do attend :)</p>
<p>As a GSoCer, I&#39;ll also get to talk about my project in something called a Lightning
Talk, where each person is given exactly 5 minutes on stage to show something. They
go on for about an hour and are really interesting because of the sheer number
of different things one gets to learn about.</p>
<p>And for the rest of the weekdays, there are talks/demos/workshops by other amazing
people. There are <em>so</em> many interesting things happening at once, I can&#39;t decide which
one to be at! I&#39;ve kind of worked out a schedule, but so many amazing talks will
be missed :(</p>
<p>I also look forward to meeting the coala developers in person - I&#39;ve only talked to them over Gitter
and I&#39;m really excited to meet them in person (plus Lasse is bringing chocolates!).</p>
<p>To finish off the conference, we have two whole days of sprints - two whole days
of pure development. It&#39;ll be really interesting to have all the coala developers
in one room, making something awesome!</p>
<p>This will be my first time in Europe and, boy am I excited about it!</p>
<p>Adhityaa</p>
<p><code>:wq</code></p>
</description>
<pubDate>Tue, 12 Jul 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/07/12/europython.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/07/12/europython.html</guid>
<category>GSOC</category>
<category>coala</category>
<category>conference</category>
</item>
<item>
<title>GSoC '16: Weeks 4 updates: Tests</title>
<description><p>Passing tests and 100% coverage are what help us sleep comfortably in the
night - there is a sense of comfort knowing that every situation gives
the expected results. And that is why the past week was writing tests!</p>
<p>I&#39;ll be honest here - I like writing the modules more than the tests.
And that is probably why I put off writing tests for so long - instead of
finishing the tests right after each module, I got too excited and kept
jumping to the next feature. Oh well.</p>
<p>Anyway, at coala, we use <a href="https://codecov.io">codecov.io</a> for coverage.
<a href="https://appveyor.com/">Appveyor</a> provides us with Windows build tests
and <a href="https://circleci.com/">CircleCI</a> is for Linux build tests. These
are totally awesome tools and you should definitely use them for your
projects - you <em>do</em> write tests, don&#39;t you?</p>
<p>There was one challenge I faced - since my project is heavily
user-interactive, every test is slightly more complex - we need to
supress the output (<code>sys.stdout</code>) and simulate the input (<code>sys.stdin</code>).
Fortunately there is already a powerful library in <code>coalib</code> that does
just this: <code>coalib.misc.ContextManagers</code>:</p>
<ul>
<li><p>With <code>suppress_stdout</code>, all writes to <code>sys.stdout</code> are forced to
redirected to <code>/dev/null</code>.</p></li>
<li><p>With <code>retrieve_stdout</code>, an alternative pipe is created to which all
output is redirected (the original <code>stdout</code> will be untouched).</p></li>
<li><p>My favorite is <code>simulate_console_inputs</code>. Just like the above two,
this is a context manager - so it&#39;s effect is easily limited. This
takes in a variable number of inputs. Want the answers to three
consecutive questions to be <code>&quot;Yes&quot;</code>, <code>&quot;**&quot;</code>, and <code>&quot;42&quot;</code>? Simply
use <code>with simulate_console_inputs(&quot;Yes&quot;, &quot;**&quot;, &quot;42&quot;):</code> and write
your logic inside. That is as simple as it can get!</p></li>
</ul>
<p><code>coalib.misc.ContextManagers</code> has a lot of other awesome stuff too. You
should definitely <a href="https://github.com/coala-analyzer/coala/tree/master/coalib/misc/ContextManagers.py">check them out</a>.</p>
<p>I still have to write an integration suite, but I&#39;ve put that off for
later - once I finish the core of my project - settings guessing. And that
will be the next two weeks.</p>
<p>So until then,<br>
Adhityaa</p>
</description>
<pubDate>Wed, 15 Jun 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/06/15/gsoc-16-coala-week-4.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/06/15/gsoc-16-coala-week-4.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>GSoC '16: Weeks 2-3 updates</title>
<description><p>Lots of activity the past few days!</p>
<p>I finally managed to get caching merged! And the performance improvements have
been terrific. On my machine, which has a HDD, running coala on coala took
around ~10 seconds to complete all sections. But with caching enabled, it takes
just 4.5 seconds - a 2x speed improvement!</p>
<p>To enable caching, just run coala with <code>--changed-files</code>. Of course, this is
currently only on the dev version, you&#39;ll have to wait till the 0.7 release
to get it on the stable version. And from 0.8, we hope to get caching enabled
by default. Really exciting stuff!</p>
<p>Another thing I worked on was automatic RST generation for bears. You can find
it in the new <a href="https://github.com/coala-analyzer/bear-docs">bear-docs</a> repo.
With this, you can easily navigate the list of bears, categorized by each
language. And for each bear, there is a description, the languages it supports,
and a table with the settings taken by the bear. For example, you can take a
look at the <a href="https://github.com/coala-analyzer/bear-docs/blob/master/docs/PyImportSortBear.rst">PyImportSortBear</a>.
Of course, this is a temporary solution till a more complete and comprehensive
website is in place.</p>
<p>And to the main topic: <code>coala-quickstart</code>. Big steps forward:</p>
<ul>
<li><p>Remember how I asked the user for a glob expression to ignore files in a
project? It&#39;s much simpler now. After <a href="https://github.com/Adrianzatreanu">Adrian&#39;s</a>
feature request <a href="https://github.com/coala-analyzer/coala-quickstart/issues/13">#13</a>,
I&#39;ve implemented automatic ignore glob generation from the user&#39;s <code>.gitignore</code>
file. But there was a slight issue: <code>git</code> uses a glob syntax that is
different from what we use at coala. So I needed to translate between the
two before directly implementing it. After going through the <a href="https://git-scm.com/docs/gitignore"><code>gitignore
documentation</code></a> and testing some cases,
I arrived at a solution that works pretty well.</p></li>
<li><p>Another big development is in the generation of glob expressions. A project
may have several languages in it; for example, Python for the code, RST for
the docs, <code>.yml</code> for the configuration. So we need to categorize each language
into its own section and add the corresponding bears to that section. But
the problem lies in file globs - we only know the <em>list</em> of files to lint,
not a concise glob expression that covers exactly that list. I wrote a neat
routine that does exactly that.</p></li>
<li><p><code>.coafile</code> generation - <code>.coafile</code> is now generated automatically. To give
you an insight into how the coafile looks, take a look at the generated
<code>.coafile</code> when I ran <code>coala-quickstart</code> on itself: <a href="https://gist.github.com/hypothesist/8a01faaa1ca48f1d24afbc146b9525ff">gist</a>.</p></li>
</ul>
<p>While I still have to write tests and get code reviews, I&#39;m fairly happy with
my progress. And the past 3-4 days, I&#39;ve been experimenting the implementation
of the core of my project - settings guessing. It&#39;s still in works, but I hope
to have something by this weekend.</p>
<p>Till then,<br>
Adhityaa</p>
</description>
<pubDate>Wed, 15 Jun 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/06/15/gsoc-16-coala-week-2.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/06/15/gsoc-16-coala-week-2.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>GSoC '16: Week 1 updates</title>
<description><p>The past week has been terrific!</p>
<p>There has been a slight shuffle in my GSoC timeline - I planned to
start with a <a href="https://github.com/coala-analyzer/coala/tree/master/coalib/bearlib"><code>bearlib</code></a>
library to enumerate the list of required and optional options for a bear
and all the possible values that they can take. This would have then been used
further on in the core of my project.</p>
<p>But I decided to start with
<a href="https://github.com/coala-analyzer/coala-quickstart"><code>coala-quickstart</code></a>
which is designed to be super-user-friendly and assist the user
in the creation of their first <code>.coafile</code>. In my experience, the beginning is
the toughest part of any change or new practice. For a user starting with
<code>coala</code> this would be the coafile generation.</p>
<p>And this utility is basically designed to make it easy. My whole project pretty
much revolves around <code>coala-quickstart</code>, so this is definitely a big step in
the forward direction.</p>
<p>But before I started with <code>coala-quickstart</code>, I needed to complete my left over
issues - file caching and casing bear. So I worked parallelly on both GSoC
and the completion of these two. I&#39;ll take a quick minute to explain both:</p>
<ul>
<li><a href="github.com/coala-analyzer/coala/pull/2016">Caching</a> is basically a core
performance improvement. Currently, when you run <code>coala</code> on a project,
all files are collected and linted. But this is a waste of computation
power - why not just run coala on those files that have changed since the
last time? That&#39;s exactly what caching is supposed to do. And the
speed improvements has been amazing - <code>coala</code> is now 3x faster (benchmarked
on <code>coala</code> source code itself).</li>
<li><a href="https://github.com/coala-analyzer/coala-bears/pull/484">CasingBear</a> is the
other one. While most of my contribution in <code>coala</code> has been in core, I
thought this would be an awesome bear to create. To give you an overview, the
bear makes a incredibly easy to enforce/toggle the casing technique in your
functions, variables, classes, objects and so on between <code>snake_casing</code>,
<code>camelCasing</code> and <code>PascalCasing</code>.</li>
</ul>
<p>Both are set to feature in the next coala release <code>0.7/0.3</code> (caching is
initially going to be an experimental feature that needs to be enabled
manually, but we hope to make it fully stable and default in 0.8). Will keep
y&#39;all updated about it.</p>
<p>Anyway, coming back to GSoC, <code>coala-quickstart</code> was previously in a very early
stage. I&#39;ve added a few cool features in the past week. Here&#39;s an overview:</p>
<ul>
<li><p>ASCII bear logo art! Pretty cool huh?
<img src="https://i.imgur.com/UFPikAC.png" alt="Welcome ASCII art"></p></li>
<li><p>There is now proper libraries to prompt a question to the user and give info.
Both are colorful too, thanks to <a href="https://github.com/coala-analyzer/PyPrint">PyPrint</a>,
a system independent python module for colors in a terminal.</p></li>
<li><p>Project based bear suggestions! Is your project mostly in Python? Just tell us
your project directory and a glob pattern to match the files you want to lint
(and ones you want to ignore), and <code>coala-quickstart</code> will automatically list
the most relevant bears you might be interested in (such as PEP8Bear, PyLintBear,
and so on along with language independent bears such as LineLengthBear).</p></li>
<li><p>A neat interface for the user to know about bears.</p></li>
<li><p>An introduction to <code>sections</code> followed by prompting the user for the sections
they want in the project. This is then followed by simple questions for each section.</p></li>
<li><p>Writing all the obtained settings to a <code>.coafile</code> in the project directory.</p></li>
</ul>
<p>Here&#39;s a neat <a href="https://asciinema.org">asciinema</a> showing off all the features:</p>
<script type="text/javascript" src="https://asciinema.org/a/46651.js" id="asciicast-46651"></script>
<p>Anyway, that was week 1. Looking forward to week 2 and the rest!</p>
<p>-- Adhityaa</p>
</description>
<pubDate>Fri, 03 Jun 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/06/03/gsoc-16-coala-week-1.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/06/03/gsoc-16-coala-week-1.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>GSoC '16!</title>
<description><p>Great news! I&#39;ve been selected for this year&#39;s GSoC (Google Summer of Code) under <a href="http://www.coala-analyzer.com/">coala</a>, a powerful static-code analysis tool that is completely modularized. You should definitely use it in your projects if you want a tool that will completely automate huge segments of code review, thereby rapidly fast-forwarding the production cycle.</p>
<p>I&#39;ve been contributing for a couple of months and the the experience has been nothing short of being phenomenal! I was recently given contributor status too :)</p>
<p>Over the course of this summer, I&#39;ll be working on a project called <em>Settings Guessing</em>. Currently coala needs the user to specify the choice for each setting - whether to use spaces or tabs, whether to use <code>snake_casing</code> or <code>camelCasing</code>, whether to use <a href="https://en.wikipedia.org/wiki/Indent_style#K.26R_style">K&amp;R style</a> or <a href="https://en.wikipedia.org/wiki/Indent_style#Allman_style">Allman style</a>. But with this project, this would guessed automatically! Totally awesome, right?</p>
<p>Stay tuned for more, I&#39;ll try to post updates weekly.</p>
</description>
<pubDate>Sun, 24 Apr 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/04/24/gsoc-16-coala.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/04/24/gsoc-16-coala.html</guid>
<category>GSOC</category>
<category>coala</category>
</item>
<item>
<title>Performance benchmark: C and Python</title>
<description><p>Hey everbody! Today I&#39;ll be doing a simple performance benchmark between Python and C.</p>
<p>I knew before starting that Python will be slower than C. And it has every reason to be so: it&#39;s an interpreted language after all. But when I actually saw the results, I was blown away. I found C to be <strong>over 22 times faster</strong>!</p>
<p>A good way to test the speed of two languages is to make them compute the first <code>N</code> prime numbers. And for this, I used <a href="https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">Sieve of Eratosthenes</a>. The reason? It&#39;s a simple, yet powerful algorithm that is very popular and is used frequently. It is, in a nutshell, a powerful benchmarking technique. Let&#39;s dive into the code. <a href="https://github.com/hypothesist/benchmark-test-c-python">[Github repository]</a></p>
<p>Here is the python code: <code>main.py</code></p>
<div class="highlight"><pre><code class="language-python" data-lang="python"><span class="kn">import</span> <span class="nn">sys</span>
<span class="n">MAX_N</span> <span class="o">=</span> <span class="mi">10000000</span>
<span class="n">prime</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span><span class="p">]</span> <span class="o">*</span> <span class="n">MAX_N</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">2</span>
<span class="k">while</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">MAX_N</span><span class="p">:</span>
<span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">+</span> <span class="s">" "</span><span class="p">)</span>
<span class="n">j</span> <span class="o">=</span> <span class="n">i</span> <span class="o">*</span> <span class="mi">2</span>
<span class="k">while</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="n">MAX_N</span><span class="p">:</span>
<span class="n">prime</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">j</span> <span class="o">+=</span> <span class="n">i</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">while</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">MAX_N</span> <span class="ow">and</span> <span class="n">prime</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
</code></pre></div>
<p>And here is the C code: <code>main.c</code></p>
<div class="highlight"><pre><code class="language-c++" data-lang="c++"><span class="cp">#include &lt;stdio.h&gt;
</span>
<span class="cp">#define MAX_N 10000000
</span>
<span class="kt">int</span> <span class="n">prime</span><span class="p">[</span><span class="n">MAX_N</span><span class="p">];</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="k">while</span><span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">MAX_N</span><span class="p">)</span> <span class="p">{</span>
<span class="n">printf</span><span class="p">(</span><span class="s">"%d "</span><span class="p">,</span> <span class="n">i</span><span class="p">);</span>
<span class="n">j</span> <span class="o">=</span> <span class="n">i</span> <span class="o">*</span> <span class="mi">2</span><span class="p">;</span>
<span class="k">while</span><span class="p">(</span><span class="n">j</span> <span class="o">&lt;</span> <span class="n">MAX_N</span><span class="p">)</span> <span class="p">{</span>
<span class="n">prime</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
<span class="n">j</span> <span class="o">+=</span> <span class="n">i</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">i</span><span class="o">++</span><span class="p">;</span>
<span class="k">while</span><span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">MAX_N</span> <span class="o">&amp;&amp;</span> <span class="n">prime</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
<span class="n">i</span><span class="o">++</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>As you may see, the two are almost identical in the steps used. But it&#39;s worthwhile to discuss the differences too:</p>
<ul>
<li>In Python, due the lack of something analogous to <code>#define</code> like in C, we have to resort to using a normal variable <code>MAX_N</code>. This might lead to a slightly slower performance compared to the preprocessor directive.</li>
<li>In Python, we use <code>i += 1</code> instead of <code>i++</code> like we do in C. I&#39;m not too sure about the performance impacts of using either, but intuitively, I feel <code>i++</code> is faster since since processors <em>may</em> have dedicated instructions for them. Again, I&#39;m unsure about this, but felt it was necessary to point out this difference.</li>
<li>In Python, you may see the <code>prime = [False] * MAX_N</code> compared to the C equivalent of <code>int prime[MAX_N]</code>. I concede that this makes it slightly slower, but on further testing, I found the impact is really negligible.</li>
</ul>
<p>And with that out of the way, let&#39;s look at the performance!</p>
<div class="highlight"><pre><code class="language-sh" data-lang="sh"><span class="gp">$ </span>gcc main.c
<span class="gp">$ </span><span class="nb">time</span> ./a.out &gt; output_c
./a.out &gt; output_c 0.43s user 0.02s system 99% cpu 0.450 total
<span class="gp">$ </span><span class="nb">time </span>python main.py &gt; output_python
python main.py &gt; output_python 9.54s user 0.08s system 100% cpu 9.611 total
<span class="gp">$ </span>diff output_c output_python
<span class="err">$</span>
</code></pre></div>
<p>There you go! The Python code takes over 9 seconds to complete the task while C takes just <strong>0.43 seconds</strong>! That&#39;s blazing fast when you consider that it just found all the primes under 10 million.</p>
<p>So there it is: while I absolutely love Python, it&#39;s simply not designed for high performance tasks. (I&#39;m not saying I&#39;m the first one to discover this, but I had to find it out for myself.)</p>
<p>Until next time,<br />
Adhityaa</p>
</description>
<pubDate>Sat, 19 Mar 2016 00:00:00 +0530</pubDate>
<link>http://hypothesist.github.io/2016/03/19/benchmark-c-python.html</link>
<guid isPermaLink="true">http://hypothesist.github.io/2016/03/19/benchmark-c-python.html</guid>
<category>C</category>
<category>Python</category>
</item>
</channel>
</rss>