Click here to Skip to main content
15,900,511 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: WSO CCC OTD 2020-02-03 - we have a winner! Pin
pkfox21-Jul-20 10:33
professionalpkfox21-Jul-20 10:33 
GeneralI might need to optimize this XD Pin
honey the codewitch2-Feb-20 6:02
mvahoney the codewitch2-Feb-20 6:02 
GeneralRe: I might need to optimize this XD Pin
Eddy Vluggen2-Feb-20 7:02
professionalEddy Vluggen2-Feb-20 7:02 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 7:28
mvahoney the codewitch2-Feb-20 7:28 
GeneralRe: I might need to optimize this XD Pin
Eddy Vluggen2-Feb-20 7:43
professionalEddy Vluggen2-Feb-20 7:43 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 9:29
mvahoney the codewitch2-Feb-20 9:29 
GeneralRe: I might need to optimize this XD Pin
Jon McKee2-Feb-20 12:54
professionalJon McKee2-Feb-20 12:54 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 15:09
mvahoney the codewitch2-Feb-20 15:09 
Yep. That's about the long and short of it.

C#
private struct _Fiber
{
	public readonly int[][] Program;
	public readonly int Index;
	public int[] Saved;
	public _Fiber(int[][] program, int index,int[] saved)
	{
		Program = program;
		Index = index;
		Saved = saved;
	}
	public _Fiber(_Fiber fiber, int index,int[] saved)
	{
		Program = fiber.Program;
		Index = index;
		Saved = saved;
	}
}


All it contains is a pointer to the program array which all fibers share, the current instruction pointer, and any saved cursor position (only used in the event of the "save" instruction)

Creating them is cheap since I just use a straight array to hold them all and it basically never gets resized, so all of them are already "live" just waiting to have their fields filled in.
Real programmers use butterflies

GeneralRe: I might need to optimize this XD Pin
Greg Utas2-Feb-20 10:21
professionalGreg Utas2-Feb-20 10:21 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 11:15
mvahoney the codewitch2-Feb-20 11:15 
GeneralRe: I might need to optimize this XD Pin
Greg Utas2-Feb-20 11:29
professionalGreg Utas2-Feb-20 11:29 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 11:46
mvahoney the codewitch2-Feb-20 11:46 
GeneralRe: I might need to optimize this XD Pin
Jörgen Andersson2-Feb-20 20:35
professionalJörgen Andersson2-Feb-20 20:35 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 23:08
mvahoney the codewitch2-Feb-20 23:08 
GeneralRe: I might need to optimize this XD Pin
Jörgen Andersson2-Feb-20 23:09
professionalJörgen Andersson2-Feb-20 23:09 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 23:12
mvahoney the codewitch2-Feb-20 23:12 
GeneralRe: I might need to optimize this XD Pin
Jörgen Andersson2-Feb-20 23:17
professionalJörgen Andersson2-Feb-20 23:17 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 23:24
mvahoney the codewitch2-Feb-20 23:24 
GeneralRe: I might need to optimize this XD Pin
Jörgen Andersson2-Feb-20 23:36
professionalJörgen Andersson2-Feb-20 23:36 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 23:57
mvahoney the codewitch2-Feb-20 23:57 
GeneralRe: I might need to optimize this XD Pin
Jörgen Andersson2-Feb-20 23:58
professionalJörgen Andersson2-Feb-20 23:58 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch3-Feb-20 0:12
mvahoney the codewitch3-Feb-20 0:12 
GeneralRe: I might need to optimize this XD Pin
ZTransform2-Feb-20 23:16
ZTransform2-Feb-20 23:16 
GeneralRe: I might need to optimize this XD Pin
honey the codewitch2-Feb-20 23:22
mvahoney the codewitch2-Feb-20 23:22 
GeneralRe: I might need to optimize this XD Pin
Jörgen Andersson2-Feb-20 23:35
professionalJörgen Andersson2-Feb-20 23:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   489 votes