《2019年Rust跨平台客户端开发在字节跳动的实践.pdf》由会员分享,可在线阅读,更多相关《2019年Rust跨平台客户端开发在字节跳动的实践.pdf(32页珍藏版)》请在三个皮匠报告上搜索。
1、C R O S S-P L A T F O R M R U S TO N T H E C L I E N T-S I D EBy wangcong ByteDanceA G E N D AWhy cross-platform and why Rust?Our experience using RustBuilding with RustPerformance requirementsEver-growing requirements withfixed resourcesNeed to achieve more with lessbattery consumptionImplementatio
2、n complexityAlmost monolithic architectureLow-level code comes with lesssafety guaranteed,traditionallySecurity considerationsClient-side programming ishardAnd,each platform isdifferentWe have to repeat our work and make newmistakesGoing cross-platform bringsusOne codebase to design,implement andrev
3、iewOne server-facing clientOne place to implement security policesC O N C E R N SPerformanceThe app should run fastThe app should not be battery-hungryLook and feelWe need platform-native appearance&interactionsWe care about user experiencewhen doing cross-platformOnly for some componentsWorks but n
4、ot enoughAll code,but with tradeoffNo system UI componentsSystem UI components with tediousand high-cost bindingsHow far do we go cross-platform?We dont sacrifice UX,especially not in frequently-used apps like FeishuNon-UI code in cross-platform,systemlanguages.Optimized for performanceUI code uses
5、platform-specific APIsW H YR U S T?We want a systems programminglanguage with safetyguaranteed,best effort isnot enoughC+is great,but your team only livesin peace when everyone is a guruWhile in Rust,the compiler acts as theguru,always watching your backGuaranteed safety,that meansmemory safety and
6、fearlessconcurrencyWe can focus on the business logic,spend less time hunting for bugsWe have the bravery and confidence toachieve moreOther things we love aboutRustMinimal runtime that easily embeds intoother languagesPerformance with zero-overheadabstractionsHigh-level language with modernfeatures