5 Coding Hacks to Reduce GC Overhead

In this post we’ll look at five ways in roomates efficient coding we can use to help our garbage collector CPU spend less time allocating and freeing memory, and reduce GC overhead. Often Long GCs can lead to our code being stopped while memory is reclaimed (AKA “stop the world”). Duke_GCPost

Some background

The GC is built to handle large amounts of allocations of short-lived objects (think of something like rendering a web page, where most of the objects allocated Become obsolete once the page is served).

The GC does this using what’s called a “young generation” – a heap segment where new objects are allocated. Each object has an “age” (placed in the object’s header bits) defines how many roomates collections it has “survived” without being reclaimed. Once a certain age is reached, the object is copied into another section in the heap called a “survivor” or “old” generation.

The process, while efficient, still comes at a cost. Being Able to reduce the number of temporary allocations can really help us increase of throughput, especially in high-scale applications.

Below are five ways everyday we can write code that is more memory efficient, without having to spend a lot of time on it, or reducing code readability.

1. Avoid implicit Strings

Strings are an integral part of almost every structure of data we manage. Being much heavier than other primitive values, they have a much stronger impact on memory usage.

One of the most important things to note is that Strings are immutable. They can not be modified after allocation. Operators such as “+” for concatenation actually allocate a new String containing the contents of the strings being joined. What’s worse, is there’s an implicit StringBuilder object that is allocated to actually do the work of combining them.

For example –

1
a = a + b; / / a and b are Strings
The compiler generates code comparable behind the scenes:

1
StringBuilder temp = new StringBuilder (a).
2
temp.append (b);
3
a = temp.toString () / / a new string is allocated here.
4
/ / The previous “a” is now garbage.
But it gets worse.

Let’s look at this example –

1
String result = foo () + arg;
2
result + = boo ();
3
System.out.println (“result =” + result);
In this example we have 3 StringBuilders allocated in the background – one for each plus operation, and two additional Strings – one to hold the result of the second assignment and another to hold the string passed into the print method. That’s 5 additional objects in what would otherwise Appear to be a pretty trivial statement.

Think about what happens in real-world scenarios such as generating code a web page, working with XML or reading text from a file. Within a nested loop structures, you could be looking at Hundreds or Thousands of objects that are implicitly allocated. While the VM has Mechanisms to deal with this, it comes at a cost – one paid by your users.

The solution: One way of reducing this is being proactive with StringBuilder allocations. The example below Achieves the same result as the code above while allocating only one StringBuilder and one string to hold the final result, instead of the original five objects.

1
StringBuilder value = new StringBuilder (“result =”);
2
value.append (foo ()). append (arg). append (boo ());
3
System.out.println (value);

This is the realization Stud Google, Moto X

Google not only successfully make the Android operating system, but apparently Google is also competing in the smartphone market plunge in collaboration with Motorola. This time I will make sure to introduce smartphone champion, Moto X on 1 August.
Various leak is scattered, including what kind of form. A leaked disseminated @ evleaks, the usual Twitter account posted the leaked gadget show looks Moto X.
Reporting from VentureBeat, Moto X design looks interesting, where the device has a 4.5 inch screen, while the kitchen spur MSM8960T of embedded processor Qualcomm Snapdragon dual core with 1.7 GHz technology. The RAM capacity of 2 GB.
As for the power of the battery, Moto X is said to rely on the battery capacity of 1500 mAh, which is powered by a battery cover with Kevlar material which is safe on the back. While Android 4.2.2 Jelly bean in trust Google and Motorola as its OS.
Plus always on listening features allow users to do voice commands without having to touch the Moto X. To run this feature, the user must activate the pass setting. Like Siri – that should say Hi Siri password first, the first command to be spoken is Ok Google Now, however, without having to press any buttons.

Hacking with a Hacker

What is it like to hack with one of the original hackers? It is certainly much different than what Appears to be the modern rendition of hacking. My experience was not getting really drunk with tons of junk food. It was not working on “beautiful” designs or “authentic” typography. It was not so much about sharing with the world as it was sharing with your peers. It had a very different feel to it than the “hacker culture” Promoted by some of the top technical Silicon Valley companies. It felt more “at home”, less dreamy, and more memorable.

I meet with Bill Gosper every so Often; I had the pleasure of giving him a tour of Facebook when I worked there. (He was so surprised that they had Coke in the glass bottles there, just like the old days.)

He is still very much a hacker, a thinker, a tinkerer, and a wonderer. Every time I meet up with him, he has a new puzzle for me, or someone around him, to solve, whether it’s really clever compass constructions, circle packing, block building, Game of Life automata solving, or even something more tangible like a Buttonhole homemade trap (which was affixed to my shirt for no less than two weeks!). He is also the bearer of interesting items, such as a belt buckle he gave me roomates depicts, in aluminum, a particular circle loose packing.
Gosper succeeding in tricking me with the Buttonhole Trap
When we meet up, all we do is hack. Along with him and one of his talented young students, we all work on something. Anything interesting, really. Last time we met up, we resurrected an old Lisp machine and did some software archeology. I brought over some of the manuals I own, like the great Chinual, and he brought over a dusty old 1U rackmount Alpha machine with OpenGenera installed. After passing a combination of Hurdles, such as that the keyboard was not interfacing with the computer Correctly, we finally got it to boot up. Now, I got to see with my own eyes, a time capsule containing a lot of Bill’s work from the 70s, 80s, and 90s, roomates could only be commanded and Examined through Zmacs dired and Symbolics Common Lisp. Our next goal was to get Symbolics Macsyma fired up on the old machine.

There was trouble with starting it up. License issues were one problem, finding and loading all of the files were compiled another. Running applications on a Lisp machine is very different than what we do today on modern machines, Windows or UNIX. There’s no. Exe file to click, or. App bundle to start up, or even a single. / File to execute. Usually it’s a collection of compiled “fast loading” or “fasl” files that get loaded side-by-side with the operating system. The application, in essence, Becomes a part of the OS.

In hacker tradition, we were Able to bypass the license issues by modifying the binary directly in Lisp. Fortunately, such as Lisp makes things easy disassembly. But how do we load the damn thing? Bill frustratingly muttered, “It’s been at least 20 years since I’ve done it. I just do not remember. “I, being an owner of MacIvory Symbolics Lisp machines, fortunately did remember how to load programs. “Bill, how about LOAD

WLCGram: Instagram Client Application for Windows Phone

Photo sharing application Instagram has been very popular among users of Android and iOS smart phones. But unfortunately Windows Phone smart phone users still have to wait to be able to use this application, because until recently the Instagram still mum about their plans for this one platform. Nokia itself as the largest WP vendors have expressed their support in order to Instagram coming soon to mobile-phone operating system Windows Phone.
While waiting for the official Instagram app is present, it does not hurt us a peek Instagram client application on Windows Phone, which WLCGram. WLCGram is one of Instagram client on Windows Phone that has capabilities similar to the original Instagram application. Some of the features include are:
filter image
could register
Can view photos on Instagram
Can menshare photos to Instagram
Can search by username or hashtag.
.
Unfortunately, the users of this application have not been able to:
Did comment and like
see video
Menshare to Facebook and Twitter.
and some other weaknesses.
With all its limitations and its advantages, the application is priced at $ 0.99 (approximately Rp. 9800) with the option for free trial for 9 hours in advance.

Galaxy Note 3, use 3 GB RAM First Time

The news about the Samsung Galaxy Note 3 made ​​it make gadget lovers curious. But this time the latest news about the hardware that is brought by the phablet. Of existing leaks, the device will reportedly be embedded RAM with a capacity of up to 3 GB.
Leaks from Slashgear did make a lot of people by surprise. But if the news is true, then the Galaxy Note 3 will be the first mobile device that is equipped with a capacity of 3 GB of RAM and a relatively very large.
Just a note, smart mobile devices and premium phablet circulating lately generally use 2 GB of RAM. Meanwhile, the Galaxy Note 3 screen size of 59.9 inches is predicted to have a Full HD resolution (1920 x 1080) with the kind of super AMOLED display panel.
The size of a half-inch larger than its predecessor, the Galaxy Note 2, which has a 5.5-inch landscape display. As for the Galaxy Note to be launched in 2011 and carries the 5.3-inch screen. Body Galaxy Note 3 allegedly bit slimmer than its predecessor. If the Galaxy Note 2 has a weight of 182 grams, the Galaxy Note 3 little lighter by 180 grams with a thickness of 8 mm.
Just like the Galaxy S4, there will be two versions of the Galaxy Note 3, which was launched to the market. In a particular market, this device will be armed with the Qualcomm Snapdragon quad-core 800. As in other markets, will use processors made by Samsung’s own Exynos SoC Octa 5.

HP Intros New Entry-Level Workstation, Pro Monitors

HP today released an update to its entry-level workstations along with a slew of new IPS Gen 2 professional grade displays.

The new HP Z230 Workstation, unveiled at the Siggraph show in Aneheim, Calif., brings professional quad-core workstations to the $999 price point. The new Z22i, Z23i, and Z24i IPS displays, meanwhile, bring wider viewing angles and power savings to the professional graphics, architecture, and engineering user.

The Z22i, Z23i, and Z24i IPS Gen 2 displays are professional grade, offering 95 to 99 percent coverage of the sRGB color space and increased color accuracy compared to previous LCD TN panels. IPS Gen 2 also offers wider viewing angles, both horizontally and vertically.

Sized at 21.5 inches (Z22i) and 23 inches (Z23i), the two smaller monitors feature a 1,920-by-1,080 (1080p) full HD 16:9 resolution. Both feature a wide range of brightness adjustments, DisplayPort, DVI, and VGA inputs, 4-way pivot/tilt, and a built-in USB 2.0 hub for your keyboard and tablet digitizer.

The 24-inch Z24i adds a 1,920-by-1,200 (16:10) resolution for workers who need more desktop real estate for toolbars and the like. The Z24i also has wide brightness adjustment, and extra niceties like a carry handle and cable management.

All these displays are Energy Star and EPEAT Gold compliant. They are available today for $239 (Z22i), $259 (Z23i), and $399 (Z24i)

The entry-level HP Z230 workstation comes in small and compact tower form factors, depending on how much expansion your professional users need. The Z230 is built around the latest Intel Xeon E3 v3 and 4th-generation Intel Core processors. The Xeon-powered models feature integrated Intel HD Graphics P4600 for professional applications, as well as options for 2D multi-display graphics cards from Nvidia and entry to high-end 3D graphics cards from AMD and Nvidia.

Systems with discrete graphics cards will be able to support up to six simultaneous displays. Multiple Hard drive and SSD options can give users speed, capacity, or both. Depending on configuration, Z230 workstations can fulfill various ISV certification needs, including high-end 3D professional graphics, ECC or non-ECC memory, and professional grade CPU requirements. HP has promised a two-year (2013-2015) platform life cycle, so you can be assured of buying new pre-qualified systems for the next two years.

The HP Z230 workstation starts at $999 for a quad core powered system, and will be available worldwide this August.

Official AMD APU Delivers Third Generation

To offer a more affordable solution to gamers with a limited budget, AMD is now officially back to bring innovation newest generation APU processor AMD A-Series APU Elite 2013 or better known as Richland passcode.
AMD APU AMD APU Authorized Delivers Third Generation computer coverage of local events
Official AMD APU Delivers Third Generation
“AMD A-Series APU Elite 2013 delivers computing experience and superb entertainment for the Desktop PC assemblers and mainstream gamers in Indonesia, especially through the balance of CPU and GPU architectures that work together in a single chip APU. Thanks to the unique technology APU, consumers who assemble PCs with AMD A-Series APU Elite will gain tremendous experience in dealing with graphics and computing workloads are increasingly complex, “said Jenny Susanto, Indonesia Country Manager of AMD.
APU processor chip is a technological innovation that combines the power of AMD CPU and GPU in a single chip processor. In the third generation, AMD GPU present collaboration with AMD Radeon 8000 series CPU performance that can run on the 4.0Ghz speed.
To offer convenience to the consumer, the third generation AMD APU is designed compatible with FM2 motherboard and is compatible with RAM memory for gaming DDR3-2133MHz to maximize its performance can increase up to 13%. In addition, there is also support from other AMD technologies such as AMD Turbo Core, AMD Eyefinity, AMD Dual Graphics support and Wireless Display.
For the price, APU A10-6800k with AMD Radeon Graphics HD 8670D is priced at around U.S. $ 142, APU A8-6600K with AMD Radeon Graphics HD 8570D approximately U.S. $ 112 and APU A6-6400 with AMD Radeon Graphics HD 8470D costs about U.S. $ 69.