Profile

Cover photo
Ian Ni-Lewis
Works at Google
6,239 followers|452,871 views
AboutPostsPhotosYouTube

Stream

Ian Ni-Lewis

Shared publicly  - 
 
Amanda and Anton get big bike helmets! Their heads are already too big for the "kids 5+" size, so we got them Giro "universal youth" helmets. The straps are super adjustable so the fit is nice and snug even though the helmet looks kind of comical on tiny little Anton. :-)
2
Constance Lewis's profile photo
 
Amanda and Anton look daarling in the helmets!
Add a comment...

Ian Ni-Lewis

Shared publicly  - 
 
I just lost most of a day's work due to a quirk in Blender. Animation clips that had taken hours to create and refine were suddenly just... gone. I couldn't believe it at first, but a search for "blender actions lost" turned up dozens of complaints... and multiple claims by the developers that the feature was "working as intended" and that users just didn't like change.

I could go into detail, but I won't. If you know Blender well enough to understand what I did "wrong," you're already familiar with the problem. Suffice it to say that due to a poor UX design, it's possible to spend hours editing objects that will not be saved.

I love Blender. It's so nice to have a pro-level 3D package that doesn't cost thousands of dollars, not to mention all of the assets that the Blender foundation gives away for free. But tonight I'm just pissed off. Blender, for all the great things you've done, thanks. But the "actions don't have fake users" decision was bad, and you should feel bad.
8
1
Tyson Jensen's profile photoIan McCully's profile photo
 
I see why Blender wanted to disable the auto assignment of bogus mouse movements to fake users thus making the average save file cleaner but it should be quite easy to detect a full on action that has been actively worked on for hours and has lots of interesting information in it and say "hmmm... hey person sitting in front of the keyboard, uh, what would you like me to do with this work because I'm about to toss it in the trash. (y/n/OMG)"
Add a comment...

Ian Ni-Lewis

Discussion  - 
 
A lot of perf tricks we use on Android are really workarounds for issues in Dalvik. ART (the runtime in Android 5+) has very different perf characteristics. I think the trick that's most likely to be affected is object pooling. Here's why:

Dalvik's allocator is surprisingly outdated. It is not designed for multicore systems. There's a single global lock for allocations and deallocations. This means that allocations are ridiculously expensive compared to ART, which has thread-local allocation. So avoiding allocations by object pooling can be a big win.

On ART, though, POJO allocations are super cheap. ART actually uses fixed-size object pools under the hood, and because they use C++ tricks that aren't available in Java (like inferring the pool from the address of the object), the cost is comparable to the cost of managing an object pool in Java. Based on code analysis, I expect allocations to be slightly slower and deallocations to be slightly faster than a good Java object pool implementation.

That's not the whole story, though. ART also has a significantly more sophisticated generational collection model. Objects with short lifetimes are incredibly cheap to collect. But because of the way ART does concurrent collection, arrays of references can be kind of expensive. The cost is roughly proportional to the amount of churn in the array, so an object pool that sees heavy use is actually more expensive than a set of short-lived allocations.

All of which means that on ART, pooling is not an automatic win. Instead, the rules for pooling become pretty much the same as any other runtime: pool objects that are either (a) expensive to create, or (b) expensive to destroy.

As I mention in APP season 2 episod 10, Paint and Paint-related objects satisfy both of those conditions. But most POJOs don't.
133
33
Sergey Povzner's profile photoHiếu Nguyễn Danh's profile photoDaniele Segato's profile photoFrancois Stephany's profile photo
16 comments
 
Thanks for this great post. Can't wait for the next post! 
+Dave Smith, you could use my android app 'Developer News for Android' to add this post to your favorites ;) https://play.google.com/store/apps/details?id=com.thinkmustache.androiddevelopernews
Add a comment...

Ian Ni-Lewis

Shared publicly  - 
 
Photo safari at Disney World
22
2
Ander Webbs's profile photoIan Ni-Lewis's profile photoFlavio Zanda's profile photoJan Husak's profile photo
2 comments
 
+Ander Webbs  I guess so? I thought at first that the image was a reflection, but the camera controls are showing up too sharply for that to be true.
Add a comment...

Ian Ni-Lewis

Shared publicly  - 
 
Here with an intro by yours truly, "High Performance Audio" By Glenn Kasten and Raph Levien. Aside from a couple of slide glitches near the beginning, it's pretty much perfect. Glenn and Raph really dive deep into the story of audio performance on Android.
20
1
Felix Homann's profile photoIan Ni-Lewis's profile photoJohnathan L.'s profile photoMihai Campean's profile photo
8 comments
 
ya i didnt get that.  but its like, computer manufacturers like using their own computers, so like, people use macs at apple, PCs at microsoft, and so on. it just seems that google might begin to do the same, but i guess not.  plus, apple and google are unofficial rivals, that is to say, Apple doesn't like google anymore.  because its like, apple doesnt want googles stuff on their iphones and stuff, so I thought google wouldnt like to use macs because of that. I didnt understand =D
Add a comment...

Ian Ni-Lewis

Shared publicly  - 
 
Saw this kite at the beach today. Want one!
12
3
Billy Patrick's profile photoTorben Henriksen's profile photoKeith Marlow's profile photoMark Lewis's profile photo
3 comments
 
Picture nice Kight
Add a comment...
Have him in circles
6,239 people
Apurba Biswas's profile photo
Hassam Zafar's profile photo
Deepak Baliga's profile photo
Rafael Rivas's profile photo
R. Neumann Marcie's profile photo
Chris Chabot's profile photo
Teja Kantamneni's profile photo
Jaime Fernández's profile photo
Troy Miller's profile photo

Ian Ni-Lewis

Shared publicly  - 
 
Thank God, I was able to salvage almost all of my #blender3d  work from yesterday from other files. Some poses gone for good, but at least the whole day isn't lost. <whew>

In the process, I learned more about using the non-linear action editor, which turns out to be really cool. It's not a complete replacement for pose libraries, but with the fake user thing making pose libs so unreliable, I think I'll be using the NLA more and more. 
2
Add a comment...

Ian Ni-Lewis

Discussion  - 
 
Use JNI to boost perf-sensitive code? You should be aware that ART uses a mark-compact GC when your app is in the background. (Currently the compact phase can't be done concurrently, although there is a lot of research in this area and I expect we'll see it implemented in some future version.) This means that object locations can change! Any code that assumes static object locations (like, for instance, some kind of map<Object*, T>) may break.

Also, remember that any Object pointers given to you by JNI are valid only for the duration of the JNI call. The compacting GC is (theoretically, at least) allowed to run while your thread is in JNI code, so if you hold an Object pointer between JNI method calls, you might find it changing underneath you!
16
2
Colt McAnlis's profile photoIan Ni-Lewis's profile photoFelix Homann's profile photoFrancois Stephany's profile photo
2 comments
 
Correct, pointers that are allocated in native code are not moveable. To be precise, they're allocated with whatever allocator is compiled into the version of bionic you're running on. Currently that's jemalloc. In previous versions it was dlmalloc.
Add a comment...

Ian Ni-Lewis

Discussion  - 
 
Achievement Unlocked: asked Android Runtime team why they used tracing GC instead of refcounting, got schooled by +Hans Boehm. Turns out he'd anticipated and refuted every single one of my arguments in a 2004 ACM paper. Really interesting reading.

Of course, the overall cost of garbage collection isn't really the issue when we're talking about application responsiveness. I think most of us would rather work around some relatively consistent per-frame overhead than deal with huge gc spikes that last a frame or more. Which is why the concurrency gains in ART are so crucial. I'm writing a paper now to explain how the ART team got those wins. It's amazing stuff. #PERFMATTERS  
15
3
Ian Ni-Lewis's profile photoChris P's profile photoSteve Jones (Trevor Drake)'s profile photoLiang Wang's profile photo
2 comments
 
+Colt McAnlis  Isn't it? A real eye-opener for me. I'm still a fan of refcounting+lazy deletion, but only on desktop systems with lots of RAM. 64GB covers a multitude of sins.
Add a comment...

Ian Ni-Lewis

Discussion  - 
 
Ran across an interesting tidbit in the new(ish) ART runtime: the object graph traversal algorithm (run as part of the "mark" part of garbage collection) accelerates traversal by storing a four-byte bitmap in each Class. The bitmap marks which of the first 32 fields in the class are objects (as opposed to primitives, which don't need to be traversed). The first field in an object is always a reference to the object's Class, so 31 user-defined fields can fit into the map. What happens if the class has more than 31 fields? Then the runtime has to fall back to finding object fields by reflection. In the current (Android L) version of the runtime, this fallback happens for all fields, even the first 31. 

GC costs in ART affect the application threads less than they did in the old Dalvik runtime, because most of the traversal happens on a separate thread, but there's an unavoidable amount of traversal that has to take place while all app threads are paused. So... yet another reason to avoid monster classes and deep hierarchies, I suppose. ;-) #PERFMATTERS  
15
2
Ian Rogers's profile photoIan Ni-Lewis's profile photoVinay Shenoy's profile photoLiu Xin's profile photo
2 comments
 
+Ian Rogers Good to know!
Add a comment...

Ian Ni-Lewis

commented on a video on YouTube.
Shared publicly  - 
 
This is awesome, but I can't get it to work if the arm is not aligned with the world axes. As soon as the local space for the forearm is no longer the same as world space, it goes all wonky. What am I doing wrong? 
2
Mike Wallace (MikeWallaceDev)'s profile photoSarandib22's profile photo
2 comments
 
Try applying rotation and scale to both meshes. Often if you are using one mesh to modify another mesh (like in the case of hooks), it will malfunction if you have resized or moved one or both of the meshes. You have to tell it to accept the new size/position as the object's =1.00, or it will try to do the calculations off the modified values (like 0.50 if you shrunk the object by half).
Add a comment...

Ian Ni-Lewis

Shared publicly  - 
 
I didn't actually do a talk at Google I/O this year--thank God, because I had a miserable head cold the entire week. Instead I did something that in the end turned out to be even better: helped my friends +Glenn Kasten and +Raph Levien put together a kickass presentation. Glenn and Raph put a huge amount of work into making not only this talk, but the actual features they talk about, a reality. They are also geniuses.

Unfortunately it wasn't live streamed, so you'll have to wait a week or two for the video. Follow +Android Developers to find out when it's available.
21
JF Dionne's profile photoPatrick Shirkey's profile photoIan Ni-Lewis's profile photoäNadia El Harche's profile photo
9 comments
 
Jada 
Add a comment...
Story
Tagline
I write code
Work
Employment
  • Google
    Developer Advocate, 2009 - present
  • Intel Corporation
    Engine Architect, 2008 - 2009
  • Xbox
    Software Engineer, 2002 - 2008
  • Acclaim Games
    Engine Architect, 2000 - 2002
  • Citrix Systems
    Software Engineer, 1999 - 2000
  • Erudite Software
    Game Programmer, 1992 - 1999
Links
Contributor to