Shipping One Million Lines of Haxe to (Over) One Million Devices Todd Kulick & Gabriel Dalbec

Overview • A little bit about TiVo • TiVo and Haxe – Evaluating Haxe for TiVo – Converting a large AS3/Flash code base

• Lessons learned • Future directions

TiVo Company Profile • Founders Mike Ramsay and Jim Barton • January 1999, TiVo unveiled it's Personal Television Service at the CES • Headquarters in Silicon Valley • Employees: ~600 • 4.5 Million active subscribers

Worldwide Presence

Multiple countries: United States, Canada, UK, Spain, Sweden, Australia, New Zealand, Mexico, Taiwan, Puerto Rico

Product Line Overview • Digital Video Recorders (Roamio) – – – –

Powerfully record HD broadcast, cable, IPTV (DVR) Record up to 1000 hours, 6 shows at once MSO/MVPD video-on-demand (VOD) integration Third-party streaming video integration (Netflix, YouTube, Hulu, etc.)

• Second Room Video Devices (Mini) – Watch recordings on multiple devices throughout the home

• Mobile Applications – Control DVRs (discover content, schedule) – Download or stream video

• Online Web Video Portal – Stream content to browser

TiVo Anywhere Stream live or recorded shows Download recorded shows Schedule and browse

TiVo and Haxe

Flash Challenges TiVo device user interface built on AS3 and Flash. • ~500,000 lines of AS3 product code • ~400,000 lines of AS3 tests

But we had looming problems… • Support for Flash is waning – Especially on embedded chipsets

• User interface performance non-ideal – On embedded devices performance was, at best, bearable

• Going forward, fewer and fewer devices would support Flash Could Haxe solve these problems?

Haxe Evaluation Criteria • Basic evaluation – Will Haxe/NME/OpenFL work for us generally? – Is the language good (typed, efficient, easy to use/understand)? – Are the right APIs/capabilities present (graphics/network/etc.)?

• Technical evaluation – – – –

Will it work well on set-top box hardware? Will the computational parts be fast(er)? Will the graphics parts be fast enough? Will it work for an application the size/scale of ours?

• Developer workflow evaluation – – – –

What is the development workflow like? How fast are incremental compiles? How effective/featureful are the code editing/searching tools? How mature are the debuggers?

Haxe Evaluation To evaluate Haxe for our purposes, we would create a Haxe prototype of our user interface application by converting some of our AS3 code to Haxe…

• Test the as3tohx conversion tool – Roughly converted 85% of the code to prototype quality

• • • •

Compare Haxe performance to Flash version Compare Haxe memory consumption to Flash version Compare Haxe image size to Flash version Evaluate Haxe development environment and tools

Haxe Evaluation Beginning early last year, four developers spent three months building a prototype and evaluating it against our criteria • • • • •

AS3 to Haxe conversion process worked reasonably Prototype’s performance was ~30% better Prototype’s memory consumption was reasonable Prototype’s image size was large, but workable Haxe development tools and IDEs were not quite as good as using Flash, but were acceptable and could be improved

Our evaluation suggested that Haxe could meet our strategic, technical and development needs! So just about one year ago, we began to convert to Haxe!

Haxe Conversion Strategy • Strategy – – – –

Convert AS3 code to Haxe Compile using haxe/hxcpp and TiVo MIPS cross-compilers Use NME/OpenFL to provide Flash API Build new NME back-end on DirectFB API • No OpenGL on many embedded set-top boxes • Customized for best performance on set-top box devices

• Scope of conversion – Total lines of code: >900,000 – Unit tests: ~17,000

Flash AIR Deployment

Encore (10’ UI) Iris Toolkit Outer Loop

Networking

Graphics

System API

AS3

Video Audio Flash API

AIR 3.0.3 Flash Engine

Devices: TiVo set-top boxes

Input

Video Custom API TiVo Flash EDK

Interfaces

Run-time

NME C++ Deployment

Encore (10’ UI) Iris Toolkit Outer Loop

Networking

Graphics

Haxe

Video Audio

Input

Video

System API

Flash API

Custom API

hxcpp (lib/hxcpp)

NME (lib/nme)

TiVo EDK (lib/edk)

Native C/C++ Runtime

Devices: TiVo set-top boxes, Android TV devices

Interfaces

Run-time

OpenFL HTML/JS Deployment

Encore (10’ UI) Iris Toolkit Outer Loop

Networking

Graphics

System API

Haxe

Video Audio Flash API

Input

Video Custom API

Interfaces

OpenFL (lib/openfl, lib/openfl-html5-dom) ? JavaScript Engine

Browser

Devices: Browsers, Connected TVs & more…

Run-time

Haxe Conversion Timeline 30 20 10 0

Spring: Looking for a strategy for “after Flash” Summer: Began learning about Haxe Fall: Began evaluating Haxe in earnest

Spring: Decision to switch to Haxe; WWX 2013

Winter: Conversion code complete

Summer: Conversion from AS3 to Haxe begins

Spring: WWX 2014 – TiVo Haxe demo! Summer: TiVo Haxe shipping!

Haxe Conversion Goals • Adobe/Flash independence – …while leveraging our current user interface codebase – Run-time smaller than embedded Adobe Flash engine, easier to improve, more opportunities

• Performance benefits – Better user experience – Makes new, additional look & feel features possible – No JIT “hiccups”, no JIT bugs(!)

• Multiplatform development efficiencies – Build great user experiences that can be targeted at many devices – Improvements made in the user experience would potentially have a longer life span and broader applicability

Challenges Workflow / development environment issues • IDE support/quality in Linux/OSX – No integrated debugging – No integrate unit test execution

Application requirements issues • Application must share graphics/audio resources • NME designed for constant drawing/games Haxe architectural issues • UTF-8 / multilingual support rough • String vs. Bytes confusion • Map implementation handling of interfaces as keys

Challenges Run-time issues • Endianness issues in hxcpp • Object churn and memory footprint • Resulting executable size – Generated reflection code large in hxcpp – Object/function boxing in hxcpp – Template size in hxcpp (not using "void*" design pattern)

Small compatibility issues • No Date object support of UTC/localtime • Weak reference bugs in hxcpp

Demo(s)

TiVo Haxe Contributions • • • • •

Improvements in as3tohx convertor (Dominguez) New hxcpp debugger New hxcpp compiled object caching IntelliJ IDEA Haxe plugin OSS'd & improved Numerous smaller Flash compatibility improvements in NME/OpenFL (Granick) • New NME back-end for TiVo STBs (DirectFB, custom-video, etc.) – Smarter redraw logic (only when necessary)

• New OpenFL HTML5 back-end (Granick) – Support for DOM rendering, optimized for low-end browsers

TiVo Future Directions • Deployments through other Haxe back-ends/languages/devices – HTML/JavaScript – Android/iOS

• Pull requests for some additional TiVo improvements • Continuing IDE/development environment improvements – Better IntelliJ environment (building, debugging, etc.) – Better multi-threaded support for GC/debugger in hxcpp

• Continuing hxcpp improvements – Image size, run-time memory footprint, performance, GC, unreflective

• Continuing Haxe/NME/OpenFL churn improvements • Continuing performance study/tuning

Haxelibs We Use/Love

We use the following...

TiVo Haxe Wishlist • Better development environment – – – –

Better IDE support on Linux Integrate debugger into IDE Integrate munit into IDE Continuing optimization of compiler and language back-ends

• Partial compilation for Haxe (libraries) • Executable image size reduction when using hxcpp • Foreign function integration API for “call in” – CFFI only defines Haxe “call out”

• Short lambdas(?!)

Haxe has helped TiVo to successfully create a faster, better user experience for our customers.

Questions?

Shipping One Million Lines of Haxe to (Over) One Million ... - GitHub

Interfaces. Run-time. Devices: TiVo set-top boxes, Android TV devices ... to Haxe; WWX 2013. Summer: Conversion from. AS3 to Haxe begins. 0. 10. 20. 30 ...

1MB Sizes 10 Downloads 188 Views

Recommend Documents

ONE million tweets to STOP violence ...
promote activism. Sp3Solidarios. TWITTER: https://twitter.com/Sp3Solidarios. BLOG: http://sp3solidarios-home-en.blogspot.com.es. FACEBOOK: ...

How To Get At Least One-Million Visitors A Year To ...
business running off free web space! You can visit Neil's site here: ... through the Scam Free Zone. So I would say those three main things: the associate program, search engine traffic, and .... I'd be able to get the best top-ten people to contribu

Introduction to Framework One - GitHub
Introduction to Framework One [email protected] ... Event Management, Logging, Caching, . ... Extend framework.cfc in your Application.cfc. 3. Done. (or in the ... All controllers are passed the argument rc containing the request.context, and all v

Haxe 3 Manual - GitHub
of programs in Haxe. Each Haxe class has an explicit name, an implied path and zero or more class fields. Here we will focus on the general structure of classes and their relations, while leaving the details of class fields for Class Fields (Chapter

one for each million Afiicans estimated to be infected ...
Clinton, software billionaire Bill Gates, and Stephen Lewis, a ...... We go to 2} neighbors. Yes, we are poor, God did not give us resources. Bu I gave us the most ...

268 million 9200 $1.14 million Economic Impact
Internet is captured by companies in traditional ... fastest-growing private companies by ... Google Analytics provides important insights into what's working in his ...

405 million 9600 $1.65 million Economic Impact
Internet is captured by companies in traditional industries.3 ... finance in 2014 to start Onovative, a banking-communications software company, they saw a ...

Epicurious engages with over 2 million followers ... Services
across their website, app, and social media channels. Every day, Epicurious ... A number of slick design features on the Epicurious site help visitors to share ... pages let you share your content with new audiences and connect with them in more enga

one for each million Afiicans estimated to be infected ...
told me how she was raising her five children on her own; her husband was ..... cruited thousands of Haitian professionals to help build the new ... shasa, a thousand miles away—because the store oo _ P ...... that creates better health w'1th HIV/

ePub Britain: One Million Years of the Human Story ...
ePub Britain: One Million Years of the Human. Story Read Online. Books detail. Title : ePub Britain: One Million Years of the Human q. Story Read Online.

Sand residence times of one million years in the Namib ...
Oct 31, 2010 - Previous cosmogenic nuclide studies north of ... 1Birkbeck College, University of London, London WC1E 7HX, UK, 2NERC ... Consequently, its concentration in grains of sand ... is indeed transported from south to north. To this ..... his

pdf-78\million-dollars-worth-of-nerve-twenty-one ...
Retrying... Whoops! There was a problem loading this page. Retrying... pdf-78\million-dollars-worth-of-nerve-twenty-one-peopl ... radise-valley-and-detroits-east-side-by-ken-colema.pdf. pdf-78\million-dollars-worth-of-nerve-twenty-one-people ... arad

Foster Raises Over $1 Million In 2013.pdf
Page 1. Whoops! There was a problem loading more pages. Foster Raises Over $1 Million In 2013.pdf. Foster Raises Over $1 Million In 2013.pdf. Open. Extract.

231 million 8300 $2.19 million Economic Impact
The Internet Association, “Internet Enabled Part-Time Small Businesses Bolster ... of online search and advertising, Hal Varian's “Online Ad Auctions,” (American.

102 million 5400 $1.22 million Economic Impact
... about methodology, visit: www.google.com/economicimpact/methodology.html. ... Chinese immigrant Chung Kun Ai founded City Mill as a lumber-importing.

35.7 million 2500 $1.55 million Economic Impact
part-time business owners rely on the ... The Internet Association, “Internet Enabled Part-Time Small Businesses ... through the Google Ad Grants program.1.

354 million 4600 $1.57 million Economic Impact
BIA/Kelsey, “Nearly All Consumers (97%) Now Use Online Media to Shop Locally,”. March 2010 3. ... Google's advertising tools, AdWords and AdSense, in 2015.1 of free advertising was ... Our website and social media help tell our story.”.

957 million 16000 $4.58 million Economic Impact
BIA/Kelsey, “Nearly All Consumers (97%) Now Use Online Media to Shop Locally,” ... results,” (International Journal of Internet Marketing and Advertising, 2009). The ... they see beautiful chocolates on our social media, they're already thinkin