Sitemap

Adobe Commerce vs. Shopware 6 vs. Shopify lines of code analytics

15 min readFeb 18, 2020

Source lines of code (SLOC), also known as lines of code (LOC), is a software metric used to measure the size of a computer program by counting the number of lines in the text of the program’s source code. SLOC is typically used to predict the amount of effort that will be required to develop a program, as well as to estimate programming productivity or maintainability once the software is produced.

SLOC measures are somewhat controversial, mainly because they are sometimes misused. However, experiments have repeatedly confirmed that effort is highly correlated with SLOC; that is, programs with larger SLOC values take more time to develop. Thus, SLOC can be effective in estimating effort.

More code is not necessarily better.

As an example, let’s compare different windows releases.

Press enter or click to view image in full size

In fact, even being “highly productive” (generating lots of code) is not necessarily the best outcome for a project (“if I had more time I would have written a shorter letter”)…

The teams had written a massive amount of code. Unfortunately, when you are building a complex system and running without clear constraints and delivery deadlines, the right mental image for a team that is generating lots of code is not one that is building a railroad and is now 90% across the country. A better image is one where you have dug an incredibly deep hole that you now have to figure out how to climb out of and fill back in. The team was just coming to grips with understanding all the implications of trying to ship OS features on top of this managed infrastructure. They recognized they had a ton of work to do to even make the basic premise a reality. On top of this, none of the major components were anywhere near ready to ship. They also started to realize the performance implications of introducing major new subsystems into existing code paths.

https://hackernoon.com/what-really-happened-with-vista-4ca7ffb5a1a

On June 14, 2006, one of the Windows developers, Philip Su, posted a blog entry that decried the development process of Windows Vista, stating that

The code is way too complicated, and that the pace of coding has been tremendously slowed down by overbearing process.

The same post also described :

Vista is said to have over 50 million lines of code, whereas XP was said to have around 40 million. (see image abovr)There are about two thousand software developers in Windows today. Assuming there are 5 years between when XP shipped and when Vista ships, those quick on the draw with calculators will discover that, on average, the typical Windows developer has produced one thousand new lines of shipped code per year during Vista. Only a thousand lines a year. […] realize that the average software developer in the US only produces around (brace yourself) 6200 lines a year. So Windows is in bad shape — but only by a constant, not by an order of magnitude.

During a demonstration of the speech recognition features new to Windows Vista at Microsoft’s Financial Analyst Meeting on July 27, 2006, the software recognized the phrase “Dear mom” as “Dear aunt.” After several failed attempts to correct the error, the sentence eventually became “Dear aunt, let’s set so double the killer delete select all.” The wealthiest software company in history can’t manage code.

Magento 2 and Adobe Commerce are Windows Vista of the eCommerce world.

Image provided by the Magento community: Gabor Imre

Vista and Magento 2 is too slow

For years, developers and IT professionals have criticized Microsoft for “software bloat” – adding so many changes and features to its programs that the code becomes vast and unwieldy. However, this never seemed to have enough of an impact on software sales. With Windows Vista, software bloat appears to have finally caught up with Microsoft.

Vista has over 50 million lines of code. XP had 35 million when it was released, and since then, it has grown to about 40 million. This software bloat has slowed down Windows Vista, especially when it’s running on anything but the latest and fastest hardware. Even then, the latest version of Windows XP soundly outperforms the latest version of Microsoft Vista. No one wants to use a new, slower computer than their old one.

As I wrote earlier about the M2 project:

Failure is a prerequisite to invention. You can’t develop a breakthrough product or process if it’s not willing to encourage risk-taking and learn from mistakes. The growing acceptance of failure is changing the way companies approach innovation. Magento 2 project should accept failure learns from mistakes and start to build Adobe Commerce 3. I hope this process has started.

Rich Skrenta writes that code is our enemy.

Code is bad. It rots. It requires periodic maintenance. It has bugs that need to be found. New features mean old code has to be adapted. The more code you have, the more places there are for bugs to hide. The longer checkouts or compiles take. The longer it takes a new employee to make sense of your system. If you have to refactor there’s more stuff to move around.

Code is produced by engineers. To make more code requires more engineers. Engineers have n² communication costs, and all that code they add to the system, while expanding its capability, also increases a whole basket of costs. You should do whatever possible to increase the productivity of individual programmers in terms of the expressive power of the code they write. Less code to do the same thing (and possibly better). Less programmers to hire. Less organizational communication costs.

That’s why better to use small serverless Microservices instead of monolithic Magento. They are doing only necessary stuff and has fewer lines of code (1000–2000 per feature)

Less actual code is always better than more. The more stuff your code does, the more failure points there are. The more stuff your code does, the less factorable it is. The more stuff your code does, the harder it is to debug and to unit test. The more stuff your code does, the longer it takes to write! So if you can accomplish the same task by doing less stuff, that’s better than if you do more stuff.

Ok, enough of the lyrics, let’s start the LOC (Lines of Code) measurements:

For the test, I have used CLOC open-source tool (https://github.com/AlDanial/cloc)

CLOC counts blank lines, comment lines, and physical lines of source code in many programming languages.

Installing CLOC

Including this instruction in case you want to recheck the data.

Install sloc from npm, a command-line tool (Node.js needs to be installed).

npm install sloc -g

Clone shallow repository (faster download than full clone).

git clone https://github.com/facebook/react/

Run sloc and specify the path that should be analyzed.

sloc “.\react\src”

sloc supports formatting the output as a cli-table, as JSON or CSV. Regular expressions can be used to exclude files and folders (Further information on npm).

Latest release: v1.84 (September 22, 2019)

Files:

PHP:(aw, ctp, phakefile, php, php3, php4, php5, php_cs, php_cs.dist, phps, phpt, phtml)JavaScript:(_js, bones, es6, jake, jakefile, js, jsb, jscad, jsfl, jsm, jss, mjs, njs, pac, sjs, ssjs, xsjs, xsjslib)XML:(adml, admx, ant, app.config, axml, builds, ccproj, ccxml, classpath, clixml, cproject, cscfg, csdef, csl, ct, depproj, ditamap, ditaval, dll.config, dotsettings, filters, fsproj, gmx, grxml, iml, ivy, jelly, jsproj, kml, launch, mdpolicy, mjml, natvis, ndproj, nproj, nuget.config, nuspec, odd, osm, packages.config, pkgproj, plist, proj, project, props, ps1xml, psc1, pt, rdf, resx, rss, scxml, settings.stylecop, sfproj, shproj, srdf, storyboard, sttheme, sublime-snippet, targets, tmcommand, tml, tmlanguage, tmpreferences, tmsnippet, tmtheme, urdf, ux, vcxproj, vsixmanifest, vssettings, vstemplate, vxml, web.config, web.debug.config, web.release.config, wsf, x3d, xacro, xib, xlf, xliff, XML, xml, xml.dist, xproj, xspec, xul, zcml)HTML:(htm, html, html.hl, xht)

Legend:

blank lines = original — non_blank

comment lines = non_blank — code

code lines = code

Magento 2

Magento 2 CE 2.3.x

exclude-dir: cache,test,generated,var

Press enter or click to view image in full size
Magento 2 CE cloc metrics output

Magento 2 CE Source lines of code:

+------------+-------+---------+
| Language | files | code |
+------------+-------+---------+
| PHP | 47060 | 3245229 |
+------------+-------+---------+
| XML | 10695 | 1021527 |
+------------+-------+---------+
| JavaScript | 2421 | 458303 |
+------------+-------+---------+
| Markdown | 1292 | 110875 |
+------------+-------+---------+
| JSON | 835 | 94887 |
+------------+-------+---------+
| CSS | 348 | 83393 |
+------------+-------+---------+
| LESS | 624 | 74117 |
+------------+-------+---------+
| HTML | 589 | 61123 |
+------------+-------+---------+
| XSD | 224 | 19209 |
+------------+-------+---------+

Just Vendor/Magento folder:

Press enter or click to view image in full size
+------------+-------+---------+
| Language | files | code |
+------------+-------+---------+
| PHP | 19971 | 1362044 |
+------------+-------+---------+
| XML | 6015 | 822084 |
+------------+-------+---------+
| JavaScript | 1320 | 235288 |
+------------+-------+---------+
| LESS | 487 | 62059 |
+------------+-------+---------+
| HTML | 424 | 33158 |
+------------+-------+---------+
| JSON | 327 | 22634 |
+------------+-------+---------+
| CSS | 99 | 19547 |
+------------+-------+---------+
| Markdown | 486 | 16121 |
+------------+-------+---------+
| XSD | 205 | 16105 |
+------------+-------+---------+
| SVG | 34 | 4373 |
+------------+-------+---------+
| GraphQL | 30 | 1853 |
+------------+-------+---------+

Excluding tests:

Press enter or click to view image in full size
+------------+-------+--------+
| Language | files | code |
+------------+-------+--------+
| PHP | 14484 | 824485 |
+------------+-------+--------+
| XML | 3125 | 699306 |
+------------+-------+--------+
| JavaScript | 1316 | 235275 |
+------------+-------+--------+
| LESS | 484 | 62038 |
+------------+-------+--------+
| HTML | 421 | 33073 |
+------------+-------+--------+
| JSON | 316 | 22342 |
+------------+-------+--------+
| CSS | 93 | 19507 |
+------------+-------+--------+

Magento 2.3.x EE

Press enter or click to view image in full size

Magento 2 EE Source lines of code:

+------------+-------+---------+
| Language | files | code |
+------------+-------+---------+
| PHP | 54097 | 3632116 |
+------------+-------+---------+
| XML | 14139 | 1225833 |
+------------+-------+---------+
| JavaScript | 6111 | 1090028 |
+------------+-------+---------+
| CSS | 630 | 115109 |
+------------+-------+---------+
| JSON | 982 | 113649 |
+------------+-------+---------+
| Markdown | 1469 | 112154 |
+------------+-------+---------+
| HTML | 1713 | 97636 |
+------------+-------+---------+
| LESS | 757 | 79682 |
+------------+-------+---------+
| XSD | 237 | 20386 |
+------------+-------+---------+

Just Vendor/Magento/ folder:

Press enter or click to view image in full size
+------------+-------+---------+
| Language | files | code |
+------------+-------+---------+
| PHP | 24296 | 1631152 |
+------------+-------+---------+
| XML | 8262 | 992890 |
+------------+-------+---------+
| JavaScript | 1686 | 267943 |
+------------+-------+---------+
| LESS | 620 | 67624 |
+------------+-------+---------+
| HTML | 572 | 36559 |
+------------+-------+---------+
| JSON | 462 | 29713 |
+------------+-------+---------+
| CSS | 103 | 19797 |
+------------+-------+---------+
| Markdown | 656 | 17314 |
+------------+-------+---------+
| XSD | 218 | 17282 |
+------------+-------+---------+
| TypeScript | 197 | 9371 |
+------------+-------+---------+
| SVG | 65 | 4655 |
+------------+-------+---------+
| GraphQL | 35 | 1974 |
+------------+-------+---------+

Excluding tests:

Press enter or click to view image in full size
+------------+-------+--------+
| Language | files | code |
+------------+-------+--------+
| PHP | 17676 | 984271 |
+------------+-------+--------+
| XML | 4404 | 747265 |
+------------+-------+--------+
| JavaScript | 1682 | 267930 |
+------------+-------+--------+
| LESS | 617 | 67603 |
+------------+-------+--------+
| HTML | 569 | 36474 |
+------------+-------+--------+
| JSON | 451 | 29421 |
+------------+-------+--------+
| CSS | 97 | 19757 |
+------------+-------+--------+
| Markdown | 430 | 16862 |
+------------+-------+--------+
| XSD | 198 | 14180 |
+------------+-------+--------+

ShopWare 6

exclude-dir:cache,.git,test,generated,var,dev-ops

Press enter or click to view image in full size
ShopWare 6 code complexity

Shopware 6 Source lines of code:

+--------------+-------+---------+
| Language | files | code |
+--------------+-------+---------+
| JavaScript | 40809 | 3849510 |
+--------------+-------+---------+
| PHP | 14050 | 1086864 |
+--------------+-------+---------+
| Markdown | 6891 | 676867 |
+--------------+-------+---------+
| JSON | 5473 | 654896 |
+--------------+-------+---------+
| TypeScript | 5680 | 150481 |
+--------------+-------+---------+
| CSS | 169 | 91705 |
+--------------+-------+---------+
| Python | 161 | 60527 |
+--------------+-------+---------+
| HTML | 235 | 57843 |
+--------------+-------+---------+
| Twig | 947 | 53863 |
+--------------+-------+---------+
| XML | 817 | 52224 |
+--------------+-------+---------+
| C++ | 132 | 43310 |
+--------------+-------+---------+
| SVG | 2170 | 33248 |
+--------------+-------+---------+
| Sass | 733 | 32890 |
+--------------+-------+---------+
| C/C++ Header | 203 | 30253 |
+--------------+-------+---------+
| YAML | 1025 | 26305 |
+--------------+-------+---------+

NOTICE:

TJ Gamble noticed:

“A little unfair to set this entire thing up by talking about engineering costs, etc as the premise but then completely ignore the Javascript as if it doesn’t need engineers or maintenance so the numbers are more skewed in the author’s favor. I’m was looking forward to reading a fair comparison as the subject is interesting but this just a skewed hit piece.”

In current installation Shopware has more JS files because of node_modules in vendor/shopware/administration/Resources/node_modules/ and vendor/shopware/storefront/Resources/app/storefront/node_modules/ folders. After removing npm modules JS count decreases. Node Modules is not an executable backend code, it is a deployment tool.

Also, the Shopware core folder was included and counted twice.

Press enter or click to view image in full size
Shopware JS Counts without NPM modules and

Anyway, in this test, we counted only backend PHP code, and it doesn’t affect Magento results. It plays into the hands of Magento 2. JS count it is topic or another post, and I don’t have clear undersending how to count (with node_modules or just pub/static folder)

Just platform folder or /vendor/shopware/platform/:

Press enter or click to view image in full size
+--------------+-------+---------+
| Language | files | code |
+--------------+-------+---------+
| JavaScript | 40744 | 3838280 |
+--------------+-------+---------+
| Markdown | 6386 | 645084 |
+--------------+-------+---------+
| JSON | 5107 | 608025 |
+--------------+-------+---------+
| PHP | 3032 | 223044 |
+--------------+-------+---------+
| TypeScript | 5680 | 150481 |
+--------------+-------+---------+
| Python | 160 | 60508 |
+--------------+-------+---------+
| HTML | 213 | 52016 |
+--------------+-------+---------+
| Twig | 826 | 44299 |
+--------------+-------+---------+
| C++ | 132 | 43310 |
+--------------+-------+---------+
| CSS | 105 | 39518 |
+--------------+-------+---------+
| Sass | 729 | 32827 |
+--------------+-------+---------+
| C/C++ Header | 202 | 30228 |
+--------------+-------+---------+
| SVG | 780 | 26043 |
+--------------+-------+---------+
| YAML | 597 | 18278 |
+--------------+-------+---------+
| XML | 141 | 17644 |
+--------------+-------+---------+

Exclude Tests:

Press enter or click to view image in full size
+------------+-------+--------+---------+---------+
| Language | files | blank | comment | code |
+------------+-------+--------+---------+---------+
| JavaScript | 40744 | 661983 | 793984 | 3838280 |
+------------+-------+--------+---------+---------+
| Markdown | 6376 | 272512 | 12 | 643893 |
+------------+-------+--------+---------+---------+
| JSON | 5095 | 4318 | 0 | 607616 |
+------------+-------+--------+---------+---------+
| TypeScript | 5680 | 18641 | 99365 | 150481 |
+------------+-------+--------+---------+---------+
| PHP | 2374 | 34140 | 23685 | 135309 |
+------------+-------+--------+---------+---------+

Sorry forget to add these files — Twig 44235

Shopware has more Java Script npm modules;), but in our case, we are comparing only PHP

Pivot results:

Just PHP Core:

Magento 2.3 CE PHP core code lines without composer dependencies = 824 485 lines, not including 699 306 XML configuration lines and PHP Tests

Magento 2.3 EE PHP core code lines without composer dependencies = 984 271 lines, not including 747 265 XML configuration lines and PHP Tests

Shopware 6 core code lines without composer dependencies = 135 309 lines of code + 44 235 Twig files = 179 544 lines of code Not including 17 861 YAML configurations and 17 318 XML files

PHP Core + Composer Dependencies + Tests:

With the generated folder. The generated folder has an additional 1 726 665 for CE and code lines 1 577 034 for EE. OMG!

Press enter or click to view image in full size

Magento 2.3 CE PHP code with composer dependencies = 3 245 229

Magento 2.3 EE PHP core code lines without composer dependencies = 3 632 116

Shopware 6 = 1 086 864 lines of code + 44 299 Twig files = 1 131 163

I found Shopware has a platform folder twice, but it’s ok it doesn’t change much.

+--------------+---------+--------+
| PHP | Full | Core |
+--------------+---------+--------+
| Magento 2 CE | 3245229 | 824485 |
+--------------+---------+--------+
| Magento 2 EE | 3632116 | 984271 |
+--------------+---------+--------+
| ShopWare 6 | 1131163 | 179544 |
+--------------+---------+--------+

Overall Magento CE Installation:

Press enter or click to view image in full size

Result: 4982291

Overall Magento EE (Adobe Commerce) Installation:

Press enter or click to view image in full size

Result: 5237899

Overall ShopWare Installation:

Press enter or click to view image in full size

End we even don’t count JS file 1M+

5M lines of code it is equal to 90 000 pages of printed text, War and Peace 70 times, Ulysses x 125, The Catcher in The Rye x 315 times, Bible has 1200 pages. So Magento 2 codebase is equal to around 75 Bibles.

So, Magento 2 depends on how to count (with vendor folder or without) located somewhere between there:

  • Large Hadron Collider
  • Linux Kernel 2.2.0
  • Photoshop CS 6
  • Unreal Engine 3
  • Age of Empire Online
Press enter or click to view image in full size

Another problem, not one of these systems is not written on pure performance programing language like PHP …

Magento 1 had 781 068 PHP code lines:

Press enter or click to view image in full size

Result: 498 2291 lines

WooComeerce + WordPress lines of code:

Press enter or click to view image in full size

Silius lines of code:

Press enter or click to view image in full size

Open Cart :

Press enter or click to view image in full size

Zen Cart:

Press enter or click to view image in full size

Presta Shop:

Press enter or click to view image in full size

ShopWare 5 :

Press enter or click to view image in full size

Just Core without composer dependencies:

Press enter or click to view image in full size

ShopWare is a great example of how a new better version of the software can contain fewer code lines:

ShopWare 5 vs. SW 6 lines of code, including tests

Excluding tests, SW5 has: 273 470 lines of code SW 6 179 544

Shopify Code line metrics :

Unfortunately, we can not measure Shopify Code, but we can get this number from open sources.

Press enter or click to view image in full size

2.8 millions line of core code:

Shopify’s core monolith has over 2.8 million lines of Ruby code and 500,000 commits. Rails doesn’t provide patterns or tooling for managing the inherent complexity and adding features in a structured, well-bounded way.

So, as we can see, Magento 2.3 has twice as much code as Shopify, and now Magento 2.4.4 has even more. Bloatware is growing exponentially. Now, we have additional MSI, GraphQL code, and many other redundant components.

The popularity of the eCommerce platform over time:

Press enter or click to view image in full size

Update 2024:

Press enter or click to view image in full size

That’s why Magento 2 is 4–10 times slower than M1:

--

--

Yegor Shytikov
Yegor Shytikov

Written by Yegor Shytikov

True Stories about Magento 2. Melting down metal server infrastructure into cloud solutions.

No responses yet