By Jason Tee
Jason Tee, Enterprise Software Architect
Creating responsive designs
What do Java developers do on a winter Sunday? Some of them like to parse JSON. Ralf Sternberg, a committer and project lead for Eclipse RAP, put together a fast and lightweight library with just ten classes. Apparently, going lean with the parser actually improves server performance because "the server processes and creates JSON messages for a large number of clients at a high rate." There are no dependencies on an external JSON library, the code is easy to maintain, and it’s not a memory hog. It isn’t going to be enough for all your JSON projects, but it does a few things well. You can find out more about usage for this mini-library here.
Writing memory efficient code
This article on Smashing Magazine is chock full of goodies for developers coding apps that will run on Google’s V8 or IE’s Chakra, etc. There’s apparently a lot going on behind the scenes with this type of JS engine. It’s important to know what these engines are doing for you. What are they optimizing and what are they unable to do? Is the garbage collector able to pick up the slack and keep things clean?
Here are just a few of the tips provided by Addy Osmani:
- Go local, not global. Help your garbage collector out by using a function-local variable that goes out of scope when it’s no longer needed.
- Clean your local data cache regularly or use an aging mechanism to do it for you so there are no big chunks of data lodged there that you aren’t going to reuse.
- If you want to store a passel of numbers or a list of objects of the same type, an array is the best option.
Get more advice along with details and examples here.
What are your favorite JS and JSP tips and tricks? Let us know your secrets.
11 Aug 2013