-
-
Save kg/1033043 to your computer and use it in GitHub Desktop.
Performance Challenges in Compiling Code to JavaScript
This file contains hidden or 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
float elapsed = ...; | |
Vector3 position = object1.Position, velocity = object1.Velocity; | |
Vector3 nextPosition = position + (velocity * elapsed); | |
GraphicsContext.DrawLine(position, nextPosition); |
This file contains hidden or 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 elapsed = ...; | |
var position = object1.Position, velocity = object1.Velocity; | |
var nextPosition = Vector3.Add(position, Vector3.Multiply(velocity, elapsed)); | |
GraphicsContext.DrawLine(position, nextPosition); |
This file contains hidden or 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 elapsed = ...; | |
var position = object1.Position, velocity = object1.Velocity; | |
velocity.MultiplyBy(elapsed); | |
position.Add(velocity); | |
GraphicsContext.DrawLine(// ... hey, wait a second ... |
This file contains hidden or 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 elapsed = ...; | |
var position = object1.Position, velocity = object1.Velocity; | |
var nextPosition = object1.NextPosition; | |
nextPosition.CopyFrom(position); | |
velocity.MultiplyBy(elapsed); | |
nextPosition.Add(velocity); | |
GraphicsContext.DrawLine(position, nextPosition); |
This file contains hidden or 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 elapsed = ...; | |
var position = object1.Position.Copy(), velocity = object1.Velocity.Copy(); | |
var nextPosition = object1.NextPosition.Copy(); | |
nextPosition.CopyFrom(position); | |
velocity.MultiplyBy(elapsed); | |
nextPosition.Add(velocity); | |
GraphicsContext.DrawLine(position, nextPosition); |
This file contains hidden or 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 elapsed = ...; | |
var position = object1.Position, velocity = object1.Velocity.Copy(); | |
var nextPosition = object1.NextPosition; | |
nextPosition.CopyFrom(position); | |
velocity.MultiplyBy(elapsed); | |
nextPosition.Add(velocity); | |
GraphicsContext.DrawLine(position, nextPosition); |
This file contains hidden or 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 elapsed = ...; | |
var position = object1.Position, velocity = object1.Velocity.Copy(); | |
var nextPosition = object1.NextPosition; | |
nextPosition.CopyFrom(position); | |
velocity.MultiplyBy(elapsed); | |
nextPosition.Add(velocity); | |
// jdoe: Add support for camera zooming (game's not using it yet so I'm not sure this works...) | |
position.MultiplyBy(Camera.ZoomFactor); | |
nextPosition.MultiplyBy(Camera.ZoomFactor); | |
GraphicsContext.DrawLine(position, nextPosition); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment