Scott Hanselman

Finding a low-memory browser

January 8, '14 Comments [64] Posted in Musings
Sponsored By
Three Browsers and their memory usage

I'm testing a 4GB Lenovo Yoga Pro 2 this week and I'm finding I'm running right up against the 4 gigs of RAM in my daily work. I usually have Visual Studio open, a browser, and a few other apps. I have IE, Chrome, and Firefox pinned in my Taskbar and usually work in Chrome. I (this just happened to be) had these tabs open:

  • Outlook.com (work email), Gmail (home email), Twitter.com, TroyHunt.com, StackOverflow.com, ArsTechnica.com, Amazon.com

Here's my task manager showing the Chrome "Canary" processes:

image

And here's the internal Chrome task manager (which is great!) showing what's really happening:

image

Certainly the memory used by my growing collection of Chrome extensions adds up. Some tabs that are "apps" like Gmail and Outlook use a 100megs or more. Regular "pages" (things that aren't heavy JS users) like Troy's blog or ArsTechnical use maybe 10megs.

If I run a small PowerShell script to collect the chrome.exe's and sum their physical memory use:

$m = ps chrome  | measure PM -Sum ; ("Chrome  {0:N2}MB " -f ($m.sum / 1mb))

I get about 1.6 gigs! On a 4 gig machine. Ouch.

C:\> .\memory.ps1
Chrome 1,623.08MB

Virtual Memory is even worse, at 6.3gigs! I start to trim the extension-fat by going to Tools | Extensions and disabling extensions I don't need now. If I'm debugging JSON, for example, I'll turn JSONView back on as needed.

Modifying my script to measure both Virtual and Physical Memory and running again with ALL non-essential plugins turned off.

C:\> .\memory.ps1
Chrome PM 1,151.72MB
Chrome VM 4,056.56MB

Big changes. Clearly the plugin thing can get out of hand quickly and running too many on a low-memory machine is a killer. I got a half-gig of memory back disabling my extraneous extensions.

Let me try the same seven sites in IE11 with no add-ons (extensions) enabled either:

IE      PM 604.11MB
IE VM 1,801.23MB

Nice improvement, less than half the VM and just over 600 megs PM. Now I'll try Firefox "Aurora." Again, same sites, logged in and running in the same state:

Firefox PM 426.58MB
Firefox VM 824.02MB

Nice. Some excellent memory optimization work happening at Mozilla it seems.

Of course, this is just 7 random sites that I happened to be visiting. Here's my poorly written PowerShell script memory.ps1

$m = ps chrome  | measure PM -Sum ; ("Chrome PM {0:N2}MB " -f ($m.sum / 1mb))
$m = ps chrome | measure VM -Sum ; ("Chrome VM {0:N2}MB " -f ($m.sum / 1mb))

$m = ps firefox | measure PM -Sum ; ("Firefox PM {0:N2}MB " -f ($m.sum / 1mb))
$m = ps firefox | measure VM -Sum ; ("Firefox VM {0:N2}MB " -f ($m.sum / 1mb))

$m = ps iexplore| measure PM -Sum ; ("IE PM {0:N2}MB " -f ($m.sum / 1mb))
$m = ps iexplore| measure VM -Sum ; ("IE VM {0:N2}MB " -f ($m.sum / 1mb))

It may be that these browser builds aren't all optimize for memory usage. I don't know. They were/are the ones I have on my machine and the ones I use. Your system, your sites, your browser builds, and your video card will change these results. Measure for yourself.

For me, I need more RAM. 4gigs just isn't reasonable no matter what browser you're running.

UPDATE: A commenter below says my results are flawed as I'm not taking into consideration how shared memory works. I am not sure (yet) I agree. Here is Chrome's about:memory feature. Who can offer thoughts?

image

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Switch easily between VirtualBox and Hyper-V with a BCDEdit boot Entry in Windows 8.1

January 8, '14 Comments [19] Posted in Tools
Sponsored By

I've been using GenyMotion for a FAST Android Emulator when developing with Visual Studio and Xamarin. However, I also use Hyper-V when developing for Windows Phone. GenyMotion use VirtualBox, which has it's own Hypervisor and you can't have two.

Some sites say to use Add/Remove Features to turn the Hyper-V support off, but that seems like a big deal to do what should be a small thing.

Instead, from an administrative command prompt I made a copy of my boot menu with a "No Hyper-V" entry:

Note the first command gives you a GUID and you then copy it and use it with the second command.

C:\>bcdedit /copy {current} /d "No Hyper-V" 
The entry was successfully copied to {ff-23-113-824e-5c5144ea}.

C:\>bcdedit /set {ff-23-113-824e-5c5144ea} hypervisorlaunchtype off
The operation completed successfully.

Now, this is important. In Windows 8.x, Windows is optimized to startup FAST. And it does. On my Lenovo it starts in about 3 seconds, faster than I can press any buttons to interrupt it. But when I want to dual boot, I need it to really shut down and give me an option to chose this new boot menu.

In order to access the new boot menu, I select Settings (Windows Key + C) then Power, and Restart but hold down shift on the keyboard while clicking Restart with the mouse.

HOLD SHIFT while pressing Restart

You will get this scary looking Blue Screen. Select "Other Operating Systems" and your "No Hyper-V" option is in there.

Windows 8.1 Boot Menu

Selecting No Hyper-V

Now, you can run Virtual Box nicely but still choose Hyper-V when you want. You can confirm VirtualBox works by noting that the Acceleration tab will not be grayed out under System Settings for your VMs. Reboot normally and Hyper-V will be back and ready to go. Here's Android running in VirtualBox via GenyMotion.

Android in an x86 VM in GenyMotion under Virtual Box - Used for Xamarin and Visual Studio Android Development in C#

There's touch support too! If you're not doing Android development like this with Visual Studio and Xamarin, frankly, you're missing out.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The new Information Worker Resume or CV Template

January 7, '14 Comments [18] Posted in Musings
Sponsored By

Scott Hanselman, Information Worker

Objective

To find a position with a dynamic and progressive technology company that utilizes my leadership abilities and skills deleting email.

Experience

Line Engineer - Gmail - Google

  • Designed and implemented a system wherein two gmail accounts with autoresponders replied to each other in a loop until one achieved sentience.
  • {I have|I've} been {reading|skimming|pretending to read} e-mails {5 years|10 years|decades|please make it stop}, and yours is definitely one of the {best|most interesting|most thoughtfully written}. {It's|It is} brightened my day and compelled me to {schedule a follow-up meeting|create a recurring meeting|create a high priority rule just for you}. {By all means|Please|I humbly beg you}, don't hesitate to e-mail me again, perhaps expanding your to a wider list?

Product Manager - Microsoft Outlook - Microsoft

  • Formulated models to determine team synergies and core competencies based entirely on depth of e-mail threads. This information fed directly into stack ranking calculations at a large unnamed software corporation in the Pacific Northwest
  • Investigated "Predictive Email Deletion" in which a sender's e-mail would be remotely deleted before it was sent.

Junior Project Manager - Yahoo! Mail - Yahoo

  • Worked on the team that pioneered the technique of sending another email after an unsubscribe request.
  • Spearheaded a study group to determine if remote workers could be contacted via e-mail. Was eventually fired as the last remote worker.

Education

Masters Degree in Computer Science

Thesis work on "The Anatomy of a Large-Scale Email Deletion Engine." I set out to prove that one could dramatically increase throughput and productivity through the use of Ctrl-A and Delete in large scale information systems. I successfully proved that information worker productivity scales linearly with e-mail deletion, and as such those with the most email should be in charge.

Bachelors of Science in Software Engineering and Product Management

Explored the psychological efforts on team dynamics of having a project manager with "1000+" in every folder in Microsoft Outlook. Teams of up to 20 people experienced disintegration of cultural barriers and constructive synergies once the first direct manager lost control of their inbox. Cannibalism quickly followed.

Volunteerism

  • Quora For Kids - Board member of non-profit dedicated to teaching kids how to unsubscribe from Quora emails.
  • Community Committee for Email Compliance - Outreach 501c3 with the mission to increase visibility of the laws around having an email signature longer than the email itself.
    • Privileged/Confidential information may be contained in this resume and may be subject to legal privilege. Access to this resume by anyone other than the intended is unauthorized. If you are not the intended recipient (or responsible for delivery of the message to such person), you may not use, copy, distribute or deliver to anyone this resume (or any part of its contents ) or take any action in reliance on it. In such case, you should destroy this message, and notify us immediately. If you have received this resume in error, please notify us immediately by postcard, fax, telegram, courier, or telephone and delete the resume from any computer. If you or your employer does not consent to resumes of this kind, please notify us immediately. All reasonable precautions have been taken to ensure no viruses are present in this resume. As our company cannot accept responsibility for any loss or damage arising from the use of this resume or attachments we recommend that you subject these to your virus checking procedures prior to use. The views, opinions, conclusions and other information expressed in this CV are not given or endorsed by the company unless otherwise indicated by an authorized representative independent of this message.

References

Please send email for references.


Going to SXSW? Come see me at 5pm on March 10th talk about email, productivity, and how to truly stay sane.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

A Coder, a Programmer, a Hacker, a Developer, and a Computer Scientist walk into a Venn Diagram

January 5, '14 Comments [55] Posted in Musings
Sponsored By
Scanned out of an IKEA Catalog - Learning to code and shopping at Ikea

A friend recently said: "I want to learn how to code. How and where do I start?"

I want to learn how to code - Do I go to Ikea or grow my own tree?

It's like woodworking. You can START by growing a tree, then chopping it down and finishing it, sanding it, before you make a table. Or you can go to Ikea. More likely you'll try something in between.

Modifying a WordPress theme is going to Ikea. Writing you own web framework is growing a tree first because you don't like the existing trees. You have to decide where on the spectrum you want to be, from being a custom furniture maker from the Woodright's Shop or someone who assembles prefabricated pieces made by someone else.

Ok, where do I start?

Very cool. I'm always happy when folks want to learn to code. The Facebook thread continued with the usual suggestions:

Then the more interesting questions started to get to the root of the matter.

Coder Developer Hacker Programmer Venn

What's the difference between a Coder, a Hacker, a Programmer, a Developer, and a Computer Scientist?

These words might all mean the same thing to you. Perhaps you hear geek, nerd, and dweeb, but we all know these have very important differences. Knowing the differences also can give you a sense of how deep you want to go on your coding adventure.

  • Coders - Can pretty much figure out it. It'll work, but it won't be pretty.
  • Hackers - usually low level folks, skillful, with detailed understanding of some area deeply, often scarily deeply.
  • Programmer - Write code and understand algorithms. Often work alone and well.
  • Developer - Are the best generalists, can use lots of different systems and languages and get them to talk to each other. Are true and broad professionals, work with people, and communicate well.
  • Computer Scientist - Need to be able to prove how computers work, at a theoretical level. Are usually math people also.

If you are closer to one of these already you can get an idea of which direction to head.

Are we assuming web programming?

Everyone on the thread assumed some kind of web programming, which makes sense, since nearly everyone's on the web in 2013. However, just a few years ago we might have sat our friend down and made a Hello World app at the console, or perhaps loaded up Visual Basic, dragged a button, and MessageBox'ed Hello World.

Is Markup Code? Lots of people said "learn HTML and CSS," but I don't think that's coding in the classical sense. As a gateway to JavaScript and Web Services, I think it's a good place to start. The thing is, though, that while not every app is a web application that makes HTML in a browser, most applications are connected applications in some way. Apps consume data from services, send notifications, texts, emails and tweets. Nearly every application is distributed in some way, even if it's just a simple app that calls a web server for some data.

If you want to be a coder today, or, let me go further and say if you want to be an effective coder, you will want understand the web and what really happens when you type twitter.com in your web browser. Just like you should understand how trees grow if you want to be a carpenter, how engines work if you want to be a race car driver, or where the water comes from if you want to be a plumber. Heck, you should really understand all of these things if you want to be an effective human. ;)

What do we really mean by "I want to learn to code?"

What's the question under the question? Does she want to make websites? Design them? Does she want to make mobile applications and take them on the go? Does she want to create a gadget that will text her when she leaves the garage door open too long? These are all very different endpoints and there's lots of great ways to get started if we dig in a little.

You can totally jump in to the web, learn a little JavaScript and start making web apps, and you should.  But as with everything, if you've got deeper interest, there are a few different paths to going further. Do a little research into the breadth of possibilities available to you, and you just might try a slightly different path.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

How to run old but awesome games from the 90s on your new computer with DOSBox

December 27, '13 Comments [23] Posted in Open Source | Tools
Sponsored By
Star Trek: Judgment Rites
 

Star Trek: Judgment RitesI was over at my parents' house for the Christmas Holiday and my mom pulled out a bunch of old discs and software from 20+ years ago. One gaame was "Star Trek: Judgment Rites" from 1995. I had the CD-ROM Collector's edition with all the audio from the original actors, not just the floppy version with subtitles. It's a MASSIVE 23 megabytes of content!

You can run Star Trek: Judgment Rites on Windows XP, but on newer operating systems that don't include DOS in the original way. Windows is no longer layered on top of DOS, although it can run some DOS apps with a virtual DOS machine (NTVDM) games rarely work. Remember things like running a Sound Blaster on DMA 1, A220 and IRQ5? Well, none of that exists anymore.

Enter DOSBox, a very complete x86 PC emulator that runs an amazing number of old games. It's likely that every old DOS game you have lying around will work great under DOSBox with a little tweaking. In fact, it'll be harder for you to get the games off floppy disks than it will to get them running.

I saw that Star Trek: Judgment Rites works great on DOSBox. There's just a few slightly non-obvious things to do to get it running (unless you read the manual. ;) )

After you install DOSBox, you'll note that there's a .conf ini file associated with your it. You can have a different .conf file for each game, then make a desktop shortcut like:

c:\dosbox\dosbox.exe "c:\games\youroldgame.exe" -conf c:\games\youroldgame.conf

Disk drives in DOSBox are virtual and you need to "mount" them, so if you want a C drive in your DOS box, you'll need to tell DOSBox which of your directories you want to be the C drive within the Box.

For example, I did this

mount C C:\dosgames

At the very bottom of the .conf file is a section called [autoexec] where you can add likes that will automatically run when DOSBox starts up, just like any autoexec.bat file. I added that mount line and then I always have a C drive within the box.

DOSBox

I can mount old CD-ROMs, like Star Trek, like this:

mount J K:\ -type cdrom

In this line, J is virtual and K: is my actual CD-ROM device with the physical Star Trek CD-ROM.

But messing with CD-ROMs is a hassle, so I used ISO Recorder for Windows, installed it, right-clicked on my drive and created a startrek.iso image file. Then, I changed my mount to

imgmount j c:\dosgames\startrek.iso -t iso

So now my startrek.conf has this at the bottom:

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount c c:\dosbox
c:
imgmount j c:\dosbox\startrek.iso -t iso

After running DOSBox with these disks mounted, I installed it using the original installer off the CD-ROM.

Sound Blaster!

Now, I have a 30" monitor, and this little 320x240 game looks WAY too small. Also, it runs in a window, and I'd like it to run Full Screen and scale. I made these changes in my .conf file.

These are just the lines I changed to get the effect I wanted. The actual .conf is very large and has lots of options.

[sdl]
fullscreen=true
fullresolution=2560x1600
output=overlay

[render]
aspect=true
scaler=normal3x

[cpu]
core=auto
cputype=auto
cycles=fixed 12000

DOSBox is a great way to introduce your kids to older games that you have fond memories of. It's also a great way to get kids playing (what I believe to be) better and higher quality games that make you think and work at a different pace. If you haven't used it before, check it out at http://www.dosbox.com.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.