none
Workarounds for combining/compiling two files? RRS feed

  • Question

  • Here's a common problem some of our users are facing.

    We don't have a feature to compile multiple files, and I'm wondering if there's a good workaround for this scenario that anyone has tried out.

    Specifically maybe there's a way to improve the performance when you paste in the two files.

    Thanks for your help!

    Here's the context of the typical multiple file scenario:

    ==============================

    I wanted to make a program to play bridge with the computer.

    A bridgegame exists of 2 parts. In the first part ( the bidding) partners give eachother information about their cards and

    in the second part the cards are played. Two totaly different technics

    I wrote the first part and it works great.

    I wrote the second part and it works great.

    Append the second program to the the first makes the total to big. Errors occur


    Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!


    Saturday, September 5, 2015 8:05 PM
    Owner

Answers

  • Absolutely, Nonki's advice and others are really the answer.

    I don't believe there is any reason that very long progrms in SB have any performance problems not seen in shorter programs.

    Errors occur almost always due to coding errors (not program size) - in SB this is most likely due to gloabal variables being asynchronously accessed in event subroutines.  The progressive (large programs) performance issue is usually arrays and graphics shapes that are not deleted properly when they are not needed any more.

    The performance issues and 'errors' are part of learning how to improve stucture, memory management (deleting stuff when finished wih it), ensuring asynrhronous event code doesn't conflict etc.

    In short, multiple SB files won't help teach how to code efficiently - SB is an excellent environment to learn efficient pogramming - not because its syntax forces it, but because the performance penalties for poor programming  are so large, so you learn why.


    Saturday, September 5, 2015 8:35 PM
    Moderator

All replies

  • I'll take the first crack at answering my own question...

    Nonki's Optimization article is a must-read for anyone facing perf issues:

    http://social.technet.microsoft.com/wiki/contents/articles/30971.small-basic-optimization.aspx

    These kind of tricks are actually valuable to learning coding, so it helps your future to work through these issues and build best practices.

    Thanks!


    Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Saturday, September 5, 2015 8:07 PM
    Owner
  • Absolutely, Nonki's advice and others are really the answer.

    I don't believe there is any reason that very long progrms in SB have any performance problems not seen in shorter programs.

    Errors occur almost always due to coding errors (not program size) - in SB this is most likely due to gloabal variables being asynchronously accessed in event subroutines.  The progressive (large programs) performance issue is usually arrays and graphics shapes that are not deleted properly when they are not needed any more.

    The performance issues and 'errors' are part of learning how to improve stucture, memory management (deleting stuff when finished wih it), ensuring asynrhronous event code doesn't conflict etc.

    In short, multiple SB files won't help teach how to code efficiently - SB is an excellent environment to learn efficient pogramming - not because its syntax forces it, but because the performance penalties for poor programming  are so large, so you learn why.


    Saturday, September 5, 2015 8:35 PM
    Moderator
  • I'm thinking it would be a rare situation where you could code 2 different game parts in complete isolation of each other. They at least would need to share a Setup, "Initatialise()" 

    Here's a thought on running 2 GameUpdates using 1 setup and 1 FrameUpdate. A possible w/around?!? A w/around in this case is probably not ideal as it's ultimately 1 game.

    'InitialiseAll()
    partOne = "True"
    
    While "True"
      If partOne Then
        'UpdateGamePartOne()    
      ElseIf partTwo Then
        'UpdateGamePartTwo()   
      Else
        Program.End()    
      EndIf
      'UpdateFrame()  
      'FrameRate()
    EndWhile

    I've used this idea before where I built a drop down menu into a game. If the menu was active the GameUpdate was conditioned out. But I had 1 setup and 1 frameUpdate.

    Just a thought.

    Maybe you could split the frameUpdate as well.

    Monday, September 7, 2015 11:30 AM
    Moderator