back to article Blinking cursor devours CPU cycles in Visual Studio Code editor

Microsoft describes Visual Studio Code as a source code editor that's "optimized for building and debugging modern web and cloud applications." In fact, VSC turns out to be rather inefficient when it comes to CPU resources. Developer Jo Liss has found that the software, when in focus and idle, uses 13 per cent of CPU capacity …

Page:

  1. Anonymous Coward
    Anonymous Coward

    "Anything less than a 60fps cursor is garbage! Go code on an Xbox, peasant!" -- PCMasterRace

    1. Anonymous Coward
      Anonymous Coward

      Joking aside, is it being claimed that rendering a bloody *cursor*- even sixty times a second, which is only high relative to the expected rate- is likely to have any noticeable effect on a modern PC?!

      1. gnasher729 Silver badge

        Most likely it's not rendering just the cursor but the whole screen.

        1. Anonymous Coward
          Anonymous Coward

          Ah yes, I should have read closer- "Chrome is doing the full rendering lifecycle (style, paint, layers) every 16ms when it should be only doing that work at a 500ms interval."

          Still, how much of that is necessary? And even at 60 times per second, I wouldn't have thought a text editor screen update would use 13% of the CPU time.

          1. gnasher729 Silver badge

            Here's a possibility: At some point the screen was updated twice a second (or when you typed), so that used 0.4% CPU time, and nobody cared how efficient or inefficient the actual drawing was. It was inefficient, but who cares if it's 0.4% CPU time inefficient?

            Then someone was careless and introduced 60 updates per second. Now the inefficiency hurts. (Of course nobody will work to make the screen updates twice as fast, if you can just set the updates back to twice a second and save a lot more CPU time).

  2. Anonymous Coward
    Anonymous Coward

    but but but

    VS code is supposed to be a lightweight editor.

    1. thames

      Re: but but but

      It's slow and not very useful. I've tried it, but I wouldn't consider switching from Geany.

      1. bombastic bob Silver badge
        Devil

        Re: but but but

        "It's slow and not very useful. I've tried it, but I wouldn't consider switching from Geany."

        I just use pluma (or gedit if gnome 2 is installed). Works well enough, highlights code elements, few irritating features (other than having to occasionally strip ending white space off of code lines, but a lot of editors cluelessly let that happen these days...) and it DOES NOT HAVE PERFORMANCE ISSUES that I can tell (even in a VM).

    2. stanimir

      Re: but but but

      I know of no framework that doesn't claim to be lightweight.

      Javascript IDE, tools and friends, what time to be alive...!

  3. Jonathan 27

    Do people like VS Code? I personally can't see the appeal, because as an editor it seems a bit slow and heavy and if I want that, I just run Visual Studio (which is much better than VS Code) and if I want light I run Atom or even GEdit or Notepad++.

    1. Mykilr

      I personally use VSCode it for Python because I haven't found a better debugger that is also free.

    2. Anonymous Coward
      Anonymous Coward

      VSCode initially had the best support for TypeScript (given that it's Microsoft's project). Props to them for exposing Typescript Language Services so other editors could quickly add support:

      https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support

    3. Anonymous Coward
      Anonymous Coward

      Yes I love it. It switched from Atom and have never looked back, I find VSCode faster with much better git integration out of the box.

      Using it for Python, node, C# and web development

  4. Anonymous Coward
    Anonymous Coward

    Leave out the cheesy animations from the web

    Most of the time they add nothing, and the relevance rarely translates between tablet and desktop.

  5. Doctor Syntax Silver badge

    The solution -

    vi

    1. P. Lee

      Re: The solution -

      >vi

      No need to be a masochist.

      Let them eat vim!

      Er, well you know what I mean.

      1. stephanh

        Re: The solution -

        One of the many things I like about Vim is that it is so fast. "vim foo.c", bam, the file is there, no loading screens or other nonsense. You search for something, bam it is there. Syntax highlighting never takes a coffee break (et tu, Emacs?).

        Non-bloated apps like Vim are great. They make you actually get to profit from faster CPU speed.

        I tried Visual Studio Code once for kicks and it was like typing in treacle.

        1. GrumpenKraut
          Boffin

          Re: The solution -

          > (et tu, Emacs?).

          The memory footprints of Emacs and vim are virtually identical (try it!). Things like the splash screen can (and should) be disabled in Emacs.

          The one situation where I find Emacs lacking in performance is for very large text files (hundreds of megabytes). And even that can be (mostly) fixed by disabling, line-number-mode and syntax highlighting if the file is larger than some threshold of your choice.

          1. stephanh

            Re: The solution -

            @GrumpenKraut

            I have no qualms with Emacs memory usage (and a quick "top" shows you are indeed right about comparable memory usage.)

            I switched from Emacs to Vim around 2000, at that time I recall that Emacs tended to be sluggish in syntax highlighting, especially on larger files. Perhaps faster CPU or performance improvements in Emacs have made the issue moot by now.

      2. Bandikoto

        Re: The solution -

        Then you get to enjoy things like trying to read darkblue text on a black background.

        Who wants to read comments, anyway?

        1. Ellipsis
          Thumb Up

          Re: The solution -

          By far the biggest advantage of a syntax-highlighting editor is that it makes comments in source code easier to ignore…

    2. tfewster
      Thumb Up

      Re: The solution -

      Obligatory xkcd: Real Programmers

      1. JoeF

        Re: The solution -

        I am wondering if Munroe got the inspiration from the first "Real Programmers" rant: Real Programmers don't use Pascal

        1. stanimir

          Re: The solution -

          >>I am wondering if Munroe got the inspiration from the first "Real Programmers" rant: Real Programmers don't use Pascal

          Obviously it a reference. I recall this paper when I was a kid (like 10)... good stuff -- still recall quotes and some of the them a partly true (like arrays and datastructures)

        2. Zippy's Sausage Factory

          Re: The solution -

          I am wondering if Munroe got the inspiration from the first "Real Programmers" rant: Real Programmers don't use Pascal

          Or The Story of Mel?

      2. Anonymous Coward
        Anonymous Coward

        Re: The solution -

        In our company they actually use vim but don't tell them about the flapping butterfly method or someone will propose it as a cost saving.

        Why would anyone want to use an IDE? That takes time to set up, time that could be better spent eking out code on vim. Hell, not even ctags works thanks to crazy includes. But why would anyone want ctags when we've got grep?

        1. Anonymous Coward
          Anonymous Coward

          Re: The solution -

          Because a good IDE makes you much more productive but for banal application made of a few files only? Because it can handle more than text files only? Because it makes debugging and profiling much easier? There is far more in a good application than just typing it.

          1. Anonymous Coward
            Anonymous Coward

            Re: The solution -

            Yes, thank you for lecturing me on the use of IDEs. I want one, there is no company support for them. I can see I should have put a joke alert tag or spelt out that the post contains sarcasm.

          2. bombastic bob Silver badge
            FAIL

            Re: The solution -

            "Because a good IDE makes you much more productive"

            which is why I've been working on one, off and on, for several years [using native X11, meaning a simplified C language toolkit to manage basic UI elements]. money would make it go faster.

            Until then, there's pluma (or gedit on gnome 2) for the code, gimp for graphics images, and 'whatever tool' (including hand-coding) for HTML and dialog layouts. When you look at the older Visual Studio versions, where hot-keys quickly got you to the thing you needed to change something on a dialog box (or add a variable, let's say), the IDE _WAS_ more productive. Since 2000-something, though, it's gotten all "property sheets" and "mousie-clickie-mousie-clickie" where it JUST! GETS! IN! THE! WAY!!!

            in short: if you have to remove one hand from the keyboard to operate a mouse more than a few times per hour, there's something wrong with the IDE.

            And DevStudio is one of the _WORST_ at that (post DevStudio '98 anyway)

    3. Dave 15

      Re: The solution -

      only for linux, for real pcs (!) try edlin or debug

      edlin was wonderful and simple

      debug is a bit hardwork but can do a whole lot more fun things

      1. Stuart Castle Silver badge

        Re: The solution -

        "only for linux, for real pcs (!) try edlin or debug

        edlin was wonderful and simple

        debug is a bit hardwork but can do a whole lot more fun things"

        Pah!

        Edlin is easy.. Real programmers use switches to manipulate the memory directly..:)

        1. Doctor Syntax Silver badge

          Re: The solution -

          "Real programmers use switches to manipulate the memory directly"

          I once read that some IBM system program was written in FORTRAN but after compilation some manual editing of the binary took place. The program as shipped had no corresponding source code.

    4. Phil O'Sophical Silver badge
      Coat

      Re: The solution -

      vi

      My fingers still have EDT keypad commands ingrained in them. I even have a customized version of microemacs where they work.

      Mine's the anorak with the PDP11 in the (large) pocket.

  6. Gene Cash Silver badge

    Heh... I remember one of the optimizations for PROFS on VM/CMS was to turn off the blinking clock in the upper right corner. Freed up 20% CPU on an IBM 4381.

  7. Denarius

    bring back vi and assembler on command lines

    Did not we all use DOS DEBUG to write machine code into .com files once as an exercise ?

    1. P. Lee

      Re: bring back vi and assembler on command lines

      >Did not we all use DOS DEBUG to write machine code into .com files once as an exercise ?

      BSAVE <filename>, <start_address>, <length>

      Apple products as they should be!

    2. allthecoolshortnamesweretaken

      Re: bring back vi and assembler on command lines

      FORTRAN 77 on a Control Data Cyber-whatsisname. Using punchcards. In the early 1980ies.

      Just sayin.

      1. Doctor Syntax Silver badge

        Re: bring back vi and assembler on command lines

        "FORTRAN 77 on a Control Data Cyber-whatsisname. Using punchcards. In the early 1980ies."

        Johnny-come-lately.

        FORTRAN IV on ICL 1900 series, punch cards, 1970.

  8. Tom 64
    Paris Hilton

    "13 per cent of CPU"

    What kind of CPU was that tested on, a celeron or an atom?

    A fresh open sees only 3% here

    1. Hans 1
      Paris Hilton

      Re: "13 per cent of CPU"

      What kind of CPU was that tested on, a celeron or an atom?

      A fresh open sees only 3% here.

      I dunno, but if you suspect it's an atom, here, you must have a crap CPU, too!

    2. Dave 15

      Re: "13 per cent of CPU"

      ONLY, ONLY, ONLY.... Only 3% is precisely 3% more than shoudl be wasted on such crap

      Really, I don't care if it is 13, 3 or even .0000003 it is extra crud that adds nothing useful and should not be present. It also adds to loading time, causes more memory page errors and use of cache etc etc etc

  9. Anonymous Coward
    Anonymous Coward

    Rule #1 for the user-facing components development

    We used to have a rule saying that the developers working on the user-facing components (such as editors, data input, visualization tools, and other data presentation) should be allocated the slowest systems their users might be running. This tends to result in the code which works well for all users.

    Obviously, the developers in question tend not to like this approach very much...

    1. Anonymous Coward
      Anonymous Coward

      Re: Rule #1 for the user-facing components development

      I get the point but spare a thought for those poor souls working in full fat Visual Studio on ASP.NET web apps. This approach would guarantee nothing will ever be delivered.

      1. Ken Hagan Gold badge

        Re: Rule #1 for the user-facing components development

        "poor souls working [...] on ASP.NET web apps. This approach would guarantee nothing will ever be delivered."

        You say that like it would be a bad thing.

    2. Ken Hagan Gold badge

      Re: Rule #1 for the user-facing components development

      Why should the developer mind? I have old boxes that I use as test systems for precisely this reason.

      1. nijam Silver badge

        Re: Rule #1 for the user-facing components development

        > I have old boxes that I use as test systems for precisely this reason.

        Perhaps because there's a difference between making the developers work on an old system, and making them test on an old system?

      2. HieronymusBloggs

        Re: Rule #1 for the user-facing components development

        "Why should the developer mind?"

        Compilation speed?

    3. Patrick Moody

      Re: Rule #1 for the user-facing components development

      I think the developer should have access to all the computing horsepower he/she desires (within the employer's budget) but that testing/debugging should be done in a deliberately crippled virtual machine. This way the actual development tools will perform well on the high spec workstation, but the application produced can be seen to work well enough on a low spec end-user's machine if it does so in the low-end virtual machine instance.

      1. swampdog
        Unhappy

        Re: Rule #1 for the user-facing components development

        I couldn't agree more. I was once tasked with making an aix system "linuxy". The first issue was to build a reliable gcc because the freeware gcc would crap out on large builds, spuriously producing object files with no code inside. Now, they could have given temporarily given me a (then new) unprovisioned power 6 box (destined to become a new oracle server) but instead some wag with the ear of those above trotted out that "give the devs crap" twaddle. I got instead, a standalone dual core power 5 box with 1G ram and iirc it would take upward of 40 minutes to build gcc 4.0.2 - except it didn't because of the afore-mentioned freeware gcc bug. There was about a weeks worth of debugging to get an initial, reliable gcc built but actual time spent was more than two months.

        1. Anonymous Coward
          Anonymous Coward

          Re: Rule #1 for the user-facing components development

          I got instead, a standalone dual core power 5 box with 1G ram and iirc it would take upward of 40 minutes to build gcc 4.0.2 - except it didn't because of the afore-mentioned freeware gcc bug. There was about a weeks worth of debugging to get an initial, reliable gcc...

          You should have invested couple of hours into reading the gcc installation manual. The SOP in cases where the native cc was missing or broken was to first build gcc as a cross-compiler on a different system, then use the cross-compiler to build stage1 for the target. This was a bit more work than the all-native installation (you also need to cross-build binutils and a few other bits), but it works very well. I used this technique to build gcc on several POWER3 and POWER4 AIX boxes far less capable than the one you describe; I do not remember it ever taking more than a day (with an overnight final test-case run judiciously thrown in - but that does not count as my time, does it?).

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like