This document describes a systematic method for detection, isolation, correction and prevention of regression, on matters of compiler performance. The method focuses on the creation of small end-to-end scaling tests that characterize, and stand in for, larger codebases on which the compiler is seen to perform poorly. These scaling tests have a number of advantages over "full sized" performance-testing codebases:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SimpleGetHTTPRequest.h | |
// | |
#import <Foundation/Foundation.h> | |
typedef void (^completionHandler_t) (id result); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)resetCoreData { | |
DDLogInfo(@"[RESET-COREDATA] Started."); | |
[MagicalRecord cleanUp]; | |
NSURL *storeURL = [NSPersistentStore MR_urlForStoreName:kMobilStoreName]; | |
NSURL *walURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-wal"]; | |
NSURL *shmURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-shm"]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For example, you use Core Data sqlite. | |
It is necessary, because sqlite database stores data in single file. | |
Whole database is single file. | |
Now you have two options. | |
1. Delete all data from all tables | |
2. Delete database sqlite file | |
Second option is clean but complex. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Dispatch | |
/// Wraps some `Base` type so that all method calls become | |
/// "message sends", e.g., `async { $0.foo() }` or `sync { $0.bar() }`. | |
public final class Actor<Base> { | |
private var instance: Base | |
private let queue: DispatchQueue | |
public init(_ instance: Base, target: DispatchQueue? = nil) { | |
self.instance = instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Signal+Extensions.swift | |
// Khan Academy | |
// | |
// Created by Nacho Soto on 10/1/15. | |
// Copyright © 2015 Khan Academy. All rights reserved. | |
// | |
import ReactiveCocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Automatically installs swiftenv and run's swiftenv install. | |
# This script was designed for usage in CI systems. | |
git clone --depth 1 https://github.com/kylef/swiftenv.git ~/.swiftenv | |
export SWIFTENV_ROOT="$HOME/.swiftenv" | |
export PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH" | |
if [ -f ".swift-version" ] || [ -n "$SWIFT_VERSION" ]; then | |
swiftenv install -s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was nice and fast... but it takes up WAY TOO MUCH space. And it's annoying to write. | |
(I like the way I can just step into the function that calls the delegate for debugging) | |
What's a better way to not make me call respondsToSelector in the middle of my code? Some proxy? | |
struct { | |
unsigned int delegateWillDisplayDocument:1; | |
unsigned int delegateDidDisplayDocument:1; | |
unsigned int delegateDidShowPageView:1; | |
unsigned int delegateDidRenderPageView:1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ids = document.querySelectorAll(".member_id"); | |
var names = document.querySelectorAll(".member_name"); | |
var output = "", length = ids.length; | |
for(var i=0; i<length; i++){ | |
output += ids[i].innerHTML.slice(1,-1) + ":" + names[i].innerHTML + "\n"; | |
} | |
console.log(output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (c) 2014 Nate Cook, licensed under the MIT License | |
/** | |
Returns a tuple with the closest compound fraction possible with Unicode's built-in "vulgar fractions". | |
See here: http://www.unicode.org/charts/PDF/U2150.pdf | |
:param: number The floating point number to convert. | |
:returns: A tuple (String, Double): the string representation of the closest possible vulgar fraction and the value of that string |
OlderNewer