Posts

Showing posts with the label performance

What does it mean that Kotlin based apps will get a performance boost on Android P

Image
Clash Royale CLAN TAG #URR8PPP What does it mean that Kotlin based apps will get a performance boost on Android P Over the last few of months in a bunch of places I've seen the information that Android P will give the performance boost to Kotlin based apps (e.g. here and here). On the official Android blog, Dave Burke in "Previewing Android P" post described it in a few words: Kotlin is a first-class language on Android, and if you haven't tried it yet, you should! We've made an enduring commitment to Kotlin in Android and continue to expand support including optimizing the performance of Kotlin code. In P you'll see the first results of this work -- we've improved several compiler optimizations, especially those that target loops, to extract better performance. We're also continuing to work in partnership with JetBrains to optimize Kotlin's generated code. You can get all of the latest Kotlin performance improvements just by keeping Android Studio...

Faster Way to Generate Rolling Calculations on a list of columns within a groupby object

Image
Clash Royale CLAN TAG #URR8PPP Faster Way to Generate Rolling Calculations on a list of columns within a groupby object I created this function to calculate the rolling stats for a list of feats in my df. This function works as intended but takes roughly 20min to run on my df which has about 1 million rows. Is there a faster way to do this in python/pandas ? def add_rolling_vars(df, feats, amounts, group): #creates rolling stats for a list of feats(columns) over a list of amounts[12,48](window sizes) #grouped by a group like $gvkey or $sector orig_feats = feats.copy() new_feats= for amount in amounts: for name in feats: df[group+'_'+name+f'_{amount}_sma'] = df.groupby(group)[name].rolling(amount,1).mean().values df[group+'_'+name+f'_{amount}_std'] = df.groupby(group)[name].rolling(amount,1).std().values df[group+'_'+name+f'_{amount}_min'] = df.groupby(group)[name].rolling(amount,1).min().values df[group...