Optimizing abc-code

hi there,
I've got another question. Our Alchemy-SWF has about 20 DoABC2-Tags. In these Tags, I often see entries like
findpropstrict     bla
getproperty       bla
In the docs, I've seen that getlex bla is the same as doing these two operations. So I thought, why not use the optimizer.exe from the bin dir of the flexsdk? After doing this, the filesize was reduced significantly by about 130kb (uncompressed). The optimizer removed the debugging-lines as well as it replaced the above op-codes with getlex. This is very nice, I think
When looking inside the optimized SWF, there's only one DoABC2-Tag left (what seems to be intelligent to me).
I have to add something to the unoptimized version: somewhere in the ABC-files, I found duplicate entries for findpropstrict, followed by a getproperty, like this:
offset 47ce4: D0                       getlocal0        
offset 47ce5: 30                       pushscope        
offset 47ce6: D0                       getlocal0        
offset 47ce7: 49 00                    constructsuper    (0)
offset 47ce9: D0                       getlocal0        
offset 47cea: D1                       getlocal1        
offset 47ceb: 68 CA 04                 initproperty      private:proc
offset 47cee: 5D 93 01                 findpropstrict    mstate
offset 47cf1: 66 93 01                 getproperty       mstate
offset 47cf4: 24 00                    pushbyte          0
offset 47cf6: 46 B1 02 01              callproperty      push (1)
offset 47cfa: 29                       pop              
offset 47cfb: 5D 93 01                 findpropstrict    mstate
offset 47cfe: 66 93 01                 getproperty       mstate
offset 47d01: 5D 93 01                 findpropstrict    mstate
offset 47d04: 66 93 01                 getproperty       mstate
offset 47d07: 66 AC 02                 getproperty       ebp
offset 47d0a: 46 B1 02 01              callproperty      push (1)
offset 47d0e: 29                       pop              
offset 47d0f: 5D 93 01                 findpropstrict    mstate
offset 47d12: 66 93 01                 getproperty       mstate
offset 47d15: 5D 93 01                 findpropstrict    mstate
offset 47d18: 66 93 01                 getproperty       mstate
offset 47d1b: 66 AB 02                 getproperty       esp
offset 47d1e: 61 AC 02                 setproperty       ebp
offset 47d21: 47                       returnvoid
May I remove the op-codes at offsets 47d01, 47d07 and 47d15, 47d18?
The optimizer optmized this of course, so I only have two entries of getlex left May I remove the duplicate entry safely without damging the file?
I also found other duplicate op-codes:
offset af271: 60 25                    getlex            cmodule.swc.blackcat:Machine
offset af273: 30                       pushscope        
offset af274: 64                       getglobalscope   
offset af275: 6C 1B                    getslot           27
offset af277: 58 42                    newclass          cmodule.swc.blackcat:FSM__longjmp
offset af279: 1D                       popscope         
offset af27a: 1D                       popscope         
offset af27b: 1D                       popscope         
offset af27c: 68 C2 05                 initproperty      cmodule.swc.blackcat:FSM__longjmp
offset af27f: 65 00                    getscopeobject    0
offset af281: 20                       pushnull
May I remove the op-codes at offset af27a and af27b?
Two final questions: Are there any other op-codes that can be merged together, like findpropstrict,getproperty => getlex?
And: Why doesn't gcc+/Flex mxmlc do these optimizations?
Best Regards,
Daniel

Hello Duncan,
if you use the "Project/Export Release Build" option in Flash Builder the IDE will compile a SWF with special optimizing flags that will also strip the debugging information. If you use the command line compilers mxmlc or compc directly please read Adobe's livedocs about the command line options. There are special flags for optimizing and stripping debug information.
It seems that you are trying to optimize your SWFs for size (and perhaps also speed). If so you might find these projects and links interesting:
Joa Ebert's apparat
Source: http://code.google.com/p/apparat/
Blog: http://blog.joa-ebert.com/
as3swf by Claus Wahlers
Source: http://github.com/claus/as3swf
Blog: http://wahlers.com.br/claus/blog/
Nicolas Cannasse's haxe
Home: http://haxe.org/
Blog: http://ncannasse.fr/blog/adobe_alchemy
Another scream on Flash, Alchemy Memory and compilers.
http://www.unitzeroone.com/blog/2009/05/22/another-scream-on-flash-alchemy-memory-and-comp ilers/
Best wishes,
- Bernd

Similar Messages

  • Extend ABC Code clasification to include code = "D" MRP1 field -  tx MM01

    Hi All
    I need to extend ABC Code clasification to include code = "D"  in MRP1 - ABC Indicator field in TX MM01, can someboby tell me how pls!!
    thks in advance

    you cannot have a D for this field.
    See transaction MC40 which is used to calculate and update this field.  There is nothing to add a D in the analysis strategy section. So you would need to re-write this transaction as well if you want a D.
    Instead use the CC - Abc indicator field in storage location view. Here you can have a D.

  • [svn:osmf:] 13412: WebPlayer: optimizing JS code to forward all query string parameters to WebPlayer.swf .

    Revision: 13412
    Revision: 13412
    Author:   [email protected]
    Date:     2010-01-11 02:02:20 -0800 (Mon, 11 Jan 2010)
    Log Message:
    WebPlayer: optimizing JS code to forward all query string parameters to WebPlayer.swf.
    Modified Paths:
        osmf/trunk/apps/samples/framework/WebPlayer/html-template/index.template.html
        osmf/trunk/apps/samples/framework/WebPlayer/src/Configuration.as

    ls -l /var/run/lighttpd/
    And how are you spawning the php instances? I don't see that in the daemons array anywhere.
    EDIT: It looks like the info in that page is no longer using pre-spawned instances, but lighttpd adaptive-spawn. The documentation has been made inconsistent it looks like.
    You will note that with pre-spawned information, the config looks different[1].
    You need to do one or the other, not both (eg. choose adaptive-spawn, or pre-spawn..not both).
    [1]: http://wiki.archlinux.org/index.php?tit … oldid=8051 "change"

  • Strange Error - 5005: Unknown error optimizing byte code.

    Hello flashcoders,
    I am facing strange problem since long time. This error code
    even doesn't exist in the list of error codes.
    This is the exact error I am getting while I compile the FLA
    from flash CS3.
    Location : , Line 1
    Description : 5005: Unknown error optimizing byte code.
    Source :
    I don't know exact reason about its generation, But here are
    the some possible reasons / hints:
    Case 1) Overloading:
    1.1) Size of .fla is 10.5 MB and its document class contains
    more than 60 classes to import and has more than 100 variables.
    1.2) Even if I put In document class - only variable
    initialization and class importing are there. Nothing in its
    constructor + no other functions are defined. Still error is there.
    1.3) If we import all classes and has all variables then it
    gives this compile error. But if we remove some particular numbers
    of variable, it's start working. In this we can remove any type of
    variables.
    1.4) After reducing variables, application starts working
    till that it won't.
    Case 2)
    2.1) Size of .fla is 1.75 MB and its document class is same
    as above one.
    2.2) All assumptions are same as above.
    2.3) Now this class contains all functions and have
    initialization of all variables + classes.
    2.4) In this If we remove 3-5 variables, it will start
    functioning else it won't.
    Its a huge application so I am even confused that what is the
    cause of error and this error stopped our working for a week now.
    Bit more information about the project that may help the team to
    identify the reason.
    1. Project development started with flash public alpha 3.
    When we started using Flash CS3, we had some design problem if we
    do open the FLA in CS3, so we completely redesigned the Movieclips
    etc., in Flash
    CS3 IDE.
    2. Project contains approx 250 classes.
    3. In main application, it imports 67 classes. (it works if I
    keep 63 classes in document class).
    4. In the case 3 above, if that works with 63 classes and If
    I do add 3 frames in existing movieclip, it stops working.
    5. In the case 3 above, if that works with 63 classes and If
    I do add / declare few more variables, it stops working.
    It would be humble appreciation if someone can come up with
    some light in the dark tunnel.
    Best Regards,
    Ashvin Savani - "arckid"
    Founder & CTO - Avinashi.com
    Adobe Community Expert
    We Never Give Up!

    I've posted an article on this problem -
    http://www.negush.net/blog/5005-unknown-error-optimizing-byte-code/
    - and here are a few ideas on how to handle it (check out the
    comments):
    - try turning off the optimizer
    - delete ASO files
    - also it seems that changing the java vm heap memory size
    could help (find he environment variables in the Windows computer
    properties and search the JAVA_TOOL_OPTIONS variable)

  • ABC code change for 500 Material

    Hi Gurus,
    I want to update / change the ABC codes of 500 materials. Please let me know how to do this (different ways). Also please tell me the Transaction Codes too.
    Thanks in advance.
    KIT
    Edited by: Kumar IT on Jan 6, 2009 1:54 AM
    Edited by: Kumar IT on Jan 6, 2009 1:55 AM

    Option 1.
    MM17/MASS : Choose the ABC indicator field MARC-MAABC, Enter all your materials and enter the relevant values.
    Don't enter any value in the upper part of the updates.If you enter some thing over there, it will be uniform updates.enter the different values of you ABC ind. (you have to work it out in Excel sheet to map exactly the material and values.) Now save it. This is time consuming bit of risk involved.
    Option 2:
    LSMW- Ask abaper to write LSMw in batch recording method Tcode MM02.
    Cheers

  • Internal table(Optimizing the codes)

    Dear all,
      Please help me in optimizing the following codes..
    FORM fetch_item_data1 .
      CLEAR itab_zsbhdr .
      LOOP AT itab_zsbhdr .
        IF itab_zsbhdr-bedae = 'SPI'.
          SELECT * FROM zioel2 INTO  i_zioel
                        WHERE ordr = itab_zsbhdr-vbeln
                        AND item = itab_zsbhdr-posnr
                        AND vdatu = itab_zsbhdr-vdatu .
            APPEND i_zioel.
            CLEAR i_zioel .
          ENDSELECT .
        ENDIF .
      ENDLOOP .
    ENDFORM.                    " FETCH_ITEM_DATA1
    MY DOUBT:
    For example if you all can see the select statement,,there we can also write as,
    data : itab_zsbhdr_dummy like itab_zsbhdr occurs 0 with header line.
    CLEAR itab_zsbhdr .
    itab_zsbhdr_dummy[] = itab_zsbhdr[].
    DELETE itab_zsbhdr_DUMMY[] WHERE bedat NE 'SPI'.
    SELECT * FROM zioel2 appending table i_zioel
                 for all entries in itab_zsbhdr_DUMMY
                     WHERE ordr = itab_zsbhdr_dummy-vbeln
                     AND item = itab_zsbhdr_dummy-posnr
                     AND vdatu = itab_zsbhdr_dummy-vdatu .
    So now we can see there is no append and modify.
    So my question is ,,"Is it the right way to go?"
    Again i am taking off the loop & instead deleting those date not equals to SPI.
    So please help me by either confirming me with this particular optimization or give me some other optimized codes on this regard.
    Thanx.

    hye..
    i am inserting my comments
    FORM fetch_item_data1 .
    CLEAR itab_zsbhdr .
    You have cleared the internal table, so the content is empty.. hence it will not enter into the loop.
    LOOP AT itab_zsbhdr .
    IF itab_zsbhdr-bedae = 'SPI'.
    SELECT * FROM zioel2 INTO i_zioel
    WHERE ordr = itab_zsbhdr-vbeln
    AND item = itab_zsbhdr-posnr
    AND vdatu = itab_zsbhdr-vdatu .
    Never use a select in a loop, this means ur hitting the database n number of times which is not at all recommondable.
    APPEND i_zioel.
    CLEAR i_zioel .
    ENDSELECT .
    instead of using select and end select it can be directly writen into
    select * from [dbtab] into table [itab] for all entreis in it_comparision
    where [field] = it_comparision-field.
    ENDIF .
    ENDLOOP .
    ENDFORM. " FETCH_ITEM_DATA1
    Yeah ur second code is more recommmended with these modifications.
    hope this is useful.
    thnks.
    imran.

  • Execution time optimizing labview code

    Hi,
    I would like to optimize my labview program. Is there a way I can plot
    the execution time of my program as a function of some parameter I am
    changing in my program. I was thinking of placing the entire program in
    a while loop and then changing the parameter during each loop iteration
    and then outputting the time that the program takes to execute as a
    function of the parameter. The problem is how would I obtain the
    execution time.
    Thank you,
    -Tim

    Here a re a few more tips:
    Running on a typical multipurpose OS will will make things a bit unpredictable because you never know what else is running so you should always repeat each run many times (then take the fastest, not the average, of all corresponding times).
    Make sure that each run takes a few hundred milliseconds to get accurate values.
    For timing purposes, it might be worth to temporarily raise the execution priority. The results will be much more reproducible (at the expense of useablility).
    LabVIEW Champion . Do more with less code and in less time .

  • Optimizing short code with XML objects

    Hi there!
    I'm trying to take into account the Garbage Collector (GC), so I decide to optimize this code:
    private function writeXMLtoModel(xmlData:XML):void{
    var listOne:XMLList = xmlData.node.children();
                for each(var xmlOne:XML in listOne){
                    var item: Object = new Object();  
                        item.one =  xmlOne.@one ;
                        item.two =  xmlOne.two ;
    For instance, is it useful to put "xmlOne = null" in every iteration?  I'm checking with the Flashdevelop's profiler, but I don't see the difference.
    maybe, I can also reuse the item object rather than creating it every time, right?
    Regards!

    everything you prefix with var inside a function body is local to the function during that function call.  ie, all those variables ( listOne and all the xmlOne and item) will be gc'd without you needing to do anything more.  (on the other hand, unless you have additional code, that function does nothing useful because no data can be obtained from it once it completes execution.)

  • Assembler in C-code for Alchemy

    Hello all!
    I aspire to reach high performance my left unfinished 3D-renderer for Flash-player. Soon enough I have understood that my ActionScript-code is doomed. Then I have started to learn Alchemy. And thanks to the help Bernd Paradies could transfer any data in the C-code and take away the ready image in the form of ByteArray. And it was essential faster. The same calculations occupying 10-15 seconds, now were measured by milliseconds.
    Wishing to move ahead further, I want to add still productivity in my code.
    I saw some topics about assembler and Alchemy.
    Also I understand what to use "x86-asm-code" in Alchemy it is impossible.
    But I want to ask. I can use "FlashPlayer-llvm-asm-code" in my C-code and in what type?
    Especially I am interested in operations of data transfer and floating point operations between registers (without using variables in memory) interest.

    Hello svolatch123,
    in this forum you'll find some posts about optimizations involving inline assembly code, i.e.:
         optimizing abc-code
         http://forums.adobe.com/thread/686022
         inline functions in C, gcc optimization and floating point arithmetic issues
         http://forums.adobe.com/thread/660099
    But in general I would avoid optimizations at the inline assembler level. Instead I would use profile your app and use the results to zoom in on specific areas that your optimizations will benefit from. You may have already done that and identified floating point calculations as one of those areas. If floating point calculations are your problem then you might be able to get better performance by using integer math internally (if that's possible). This technique is used by programs like Donald Knuth's TeX. The idea is that you do your math in integer units of floats (i.e. 1.234cm = 1 unit, 2 * 3 = 6 units = 6 * 1.234cm = 7.404cm).
    Another performance hog that will probably show up in your profiling results will probably point you to the fact that crossing the border between AS3 and C world (calling from AS3 code into Alchemy-C code and vice versa) is very expensive. You'll get good performance improvements by reducing calls that cross that boundary.
    If there is a piece of code in particular that you need to optimize I would post it here in this forum.
    I am sure you'll find help here.
    Best wishes,
    - Bernd

  • Need help in optimizing the ABAP code

    Hi,
    Can anyone help me in optimizing the code. Here the select statement has select within the loop. Need help in optimization.
    WHEN '0CO_PC_PCP_03'.
    LOOP AT C_T_DATA INTO TBL_KKBW_ITEM.
          W_TABIX = SY-TABIX.
          IF TBL_KKBW_ITEM-CURRENCY_TYPE EQ '20'.
    SELECT SINGLE KALNR KALKA KADKY TVERS KADAT KOKRS INTO (W_KALNR, W_KALKA, W_KADKY, W_TVERS,  
                    TBL_KKBW_ITEM-COSTING_DATE,
                    TBL_KKBW_ITEM-CONTROLLING_AREA)           
                    FROM KEKO                                  
                       WHERE KLVAR EQ TBL_KKBW_ITEM-COSTING_VARIANT                              
                        AND  KADKY EQ TBL_KKBW_ITEM-COSTING_DATE
                        AND  TVERS EQ TBL_KKBW_ITEM-COSTING_VERSION                           
                        AND  MATNR EQ TBL_KKBW_ITEM-HEADER_MATERIAL                             
                        AND  WERKS EQ TBL_KKBW_ITEM-HEADER_PLANT.
               IF SY-SUBRC EQ 0.                                
              SELECT SINGLE KOSTL INTO TBL_KKBW_ITEM-COST_CENTER
                              FROM CKIS WHERE KOSTL NE SPACE   
                                         AND  KALNR EQ W_KALNR 
                                         AND  KALKA EQ W_KALKA 
                                         AND  KADKY EQ W_KADKY 
                                         AND  TVERS EQ W_TVERS.
              IF SY-SUBRC NE 0.                                
                CLEAR TBL_KKBW_ITEM-COST_CENTER.               
              ENDIF.                                           
            ENDIF.                                             
            MODIFY C_T_DATA FROM TBL_KKBW_ITEM INDEX W_TABIX.
          ELSE.
            DELETE C_T_DATA INDEX W_TABIX.
          ENDIF.
        ENDLOOP.
    Thanks,
    Rani.

    hi
    plz use the below code :
    WHEN '0CO_PC_PCP_03'.
    SELECT  KALNR KALKA KADKY TVERS KADAT KOKRS INTO it_keko "declare internal table with the mentioned fields
    " also select the fields to be used in where condition
    FROM KEKO
    for all entries in c_t_data
    WHERE KLVAR EQ c_t_data-COSTING_VARIANT
    AND KADKY EQ c_t_data-COSTING_DATE
    AND TVERS EQ c_t_data-COSTING_VERSION
    AND MATNR EQ c_t_data-HEADER_MATERIAL
    AND WERKS EQ c_t_data-HEADER_PLANT.
    "sort the tables on the fields used in where.
    IF SY-SUBRC EQ 0.
    SELECT  KOSTL "and other fields to be used in where
    INTO it _ckis
    FROM CKIS
    for all entries in c_t_data
    WHERE KOSTL NE SPACE "use c_t_data
    AND KALNR EQ W_KALNR
    AND KALKA EQ W_KALKA
    AND KADKY EQ W_KADKY
    AND TVERS EQ W_TVERS.
    IF SY-SUBRC NE 0.
    CLEAR TBL_KKBW_ITEM-COST_CENTER.
    ENDIF.
    it_data[] = c_t_data. "declare it_data same as the extract structure
    delete it_data where CURRENCY_TYPE  NE '20'.
    LOOP AT it_data assigning <fs_data>. "use field symbols
    read from it_keko into wa_keko
    where
    KLVAR EQ <fs_data>-COSTING_VARIANT
    AND KADKY EQ <fs_data>-COSTING_DATE
    AND TVERS EQ <fs_data>-COSTING_VERSION
    AND MATNR EQ <fs_data>-HEADER_MATERIAL
    AND WERKS EQ<fs_data>-HEADER_PLANT
    binary search.
    if sy_subrc = 0.
    similarly read from the second itab
    ENDIF.
    ENDLOOP.
    c_t_data[] = it_data[].
    Pls let me know in case of any issues
    Regards,
    Aparna
    Edited by: Aparna KS on Jun 13, 2010 11:01 PM

  • Labview FPGA optimizing code (reducing resources)

    Hi there,
    I am new to this forum and have questions regarding to optimizing FPGA code since I have a very big program. Currently, I need to reduce resources first, and listing the questions here. Some of them are kind of "making sure" question.
    - In this link: http://digital.ni.com/public.nsf/allkb/311C18E2D63​5FA338625714700664816
    It says "Eliminate Arrays on the Front Panel", what if I use array without shown up on Front Panel? Does it take a lot of resources?
    - Should I change every array in my code to block memory? For array, we can manipulate data, for example rotate 1D array. If I change to block memory, I will have to write all of the manipulations by myself.
    - Because the program is big, I wanted to put them in subVIs to make it easier to read, also can reduce loop time when the subVIs run parallely, I want to make sure that this change will not increase the resource? I learnt that indicators on front panel of subVIs don't increase resources consumption.
    - Multiplication takes few resources/calculation time than division?
    Thanks in advance :-)

    - Thanks guys for the informative posts, the subVI is reentrant as default. I just call this subVI once in the main VI so I guess there's no problem with entrancy/reentrancy. 
    - Currenly, I am having a problem with DSP48E as in the pic attached. I changed the compiling option to "Area" instead of "Timing performance" but it doesn't resolve the problem. It is quite weird since I did some little change in the code, and the new code is not too much larger than the old one. The 2nd pic is for the old code, the amount of resources is big, but still in a good range. Even when I tried to delete some more things, the problem still exists. When through this post (http://forums.ni.com/t5/LabVIEW/Large-FPGA-vi-comp​iled-in-LV-2009-but-not-2010/td-p/1636950) but not sure what should do. Since I thought that high through put math takes more resources than normal math. And because I have a lot of math calculations, changing all of them is not a nice thing to do. 
    I am using Labview 2011, cRIO-9118.
    Attachments:
    DSP48.JPG ‏134 KB
    old_code.JPG ‏90 KB

  • Optimization of Codes in ABAP

    Hello there,
    Can anyone help me about my problem in optimizing my code in ABAP..
    before i used SDF logical dbf..but simple select in BSIS,BKPF and BSEG tables are much faster than using logical dbf..but my main problem is it took a while also in processing a report while using a select statement..here is my sample code.
    It took 2mins in processing a report...Hope someone can help me
    Please give me some advice.
    Thanks in advance
    aVaDuDz
    SELECT SINGLE *
      FROM skb1
      WHERE bukrs EQ p_bukrs
      AND saknr EQ p_saknr.
      IF sy-subrc EQ 0.
        SELECT blart belnr waers monat budat bukrs hkont buzei
               shkzg dmbtr wrbtr gjahr
        INTO CORRESPONDING FIELDS OF TABLE it_bsis
        FROM bsis
        WHERE bukrs EQ p_bukrs
        AND hkont EQ p_saknr
        AND gjahr IN p_gjahr
        AND monat IN p_monat.
        PERFORM add_record.
      ENDIF.
    FORM add_record .
      LOOP AT it_bsis.
        g_percn = 1.
        CLEAR g_indic.
        g_indic = c_indic.
        REPLACE '&' WITH it_bsis-belnr INTO g_indic.
        REPLACE '%' WITH it_bsis-buzei INTO g_indic.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            percentage = g_percn
            text       = g_indic.
        READ TABLE it_data ASSIGNING <data>
             WITH KEY  belnr = it_bsis-belnr "document #
                       buzei = it_bsis-buzei. "Line Item
        IF sy-subrc <> 0.
          APPEND INITIAL LINE TO it_data ASSIGNING <data>.
          <data>-belnr = it_bsis-belnr. "document #
          <data>-buzei = it_bsis-buzei. "Line Item
        ENDIF.
        <data>-bukrs = it_bsis-bukrs. "Company
        <data>-hkont = it_bsis-hkont. "G/L Acct.
        <data>-gjahr = it_bsis-gjahr.
        <data>-waers = it_bsis-waers.
        <data>-belnr = it_bsis-belnr.
        <data>-monat = it_bsis-monat.
        <data>-budat = it_bsis-budat.
        <data>-blart = it_bsis-blart.
        IF it_bsis-shkzg ='H'.
          <data>-wrbtr = it_bsis-wrbtr * -1.
          <data>-dmbtr = it_bsis-dmbtr * -1.
        ELSE.
          <data>-wrbtr = it_bsis-wrbtr.
          <data>-dmbtr = it_bsis-dmbtr.
        ENDIF.
        SELECT SINGLE lifnr sgtxt
         FROM bseg
         INTO gs_vendor
         WHERE belnr  =  it_bsis-belnr
         AND gjahr IN p_gjahr
         AND lifnr NE ''.
        SELECT SINGLE lifnr name1 stcd1
         FROM lfa1
         INTO gs_lfa1
         WHERE lifnr = gs_vendor-lifnr.
        <data>-lifnr = gs_lfa1-lifnr.
        <data>-sgtxt = gs_vendor-sgtxt.
        <data>-name1 = gs_lfa1-name1.
        <data>-stcd1 = gs_lfa1-stcd1.
        SELECT SINGLE wt_withcd
        FROM with_item
        INTO gs_item
        WHERE belnr = it_bsis-belnr
        AND gjahr IN p_gjahr.
        IF sy-subrc EQ 0.
          <data>-mwskz = gs_item.
        ENDIF.
        SELECT SINGLE ppnam usnam bldat
        FROM bkpf
        INTO gs_bkpf
        WHERE belnr = it_bsis-belnr
        AND gjahr IN p_gjahr.
        <data>-ppnam = gs_bkpf-ppnam.
        <data>-usnam = gs_bkpf-usnam.
        <data>-bldat = gs_bkpf-bldat.
      ENDLOOP.
    ENDFORM.                    " add_record

    Hi,
    Check this code. See the comments where i have mentioned "Add / Remove this".
    For tables like BSEG, BKPF and WITH_ITEM you have to provide complete key to read from table. BUKRS should be the first field in select statement.
    Also, you do not need to check LIFNR  NE '', when you select from BSEG. Just read the first line item. It is vendor / customer line item.
    Also, <b>DO NOT USE SAPGUI_PROGRESS_INDICATOR inside loop</b>. It does affect performance.
    Let me know if you still have performance issue.
    SELECT SINGLE *
                   FROM skb1
                   WHERE bukrs EQ p_bukrs
                   AND saknr EQ p_saknr.
    IF sy-subrc EQ 0.
      SELECT blart belnr waers monat budat bukrs hkont buzei
      shkzg dmbtr wrbtr gjahr
      INTO CORRESPONDING FIELDS OF TABLE it_bsis
      FROM bsis
      WHERE bukrs EQ p_bukrs
      AND hkont EQ p_saknr
      AND gjahr IN p_gjahr
      AND monat IN p_monat.
      PERFORM add_record.
    ENDIF.
    *       FORM add_record                                               *
    FORM add_record .
      LOOP AT it_bsis.
        g_percn = 1.
        CLEAR g_indic.
        g_indic = c_indic.
        REPLACE '&' WITH it_bsis-belnr INTO g_indic.
        REPLACE '%' WITH it_bsis-buzei INTO g_indic.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
             EXPORTING
                  percentage = g_percn
                  text       = g_indic.
        READ TABLE it_data ASSIGNING <data>
        WITH KEY belnr = it_bsis-belnr "document #
        buzei = it_bsis-buzei. "Line Item
        IF sy-subrc <> 0.
          append initial line to it_data assigning <data>.
          <data>-belnr = it_bsis-belnr. "document #
          <data>-buzei = it_bsis-buzei. "Line Item
        ENDIF.
        <data>-bukrs = it_bsis-bukrs. "Company
        <data>-hkont = it_bsis-hkont. "G/L Acct.
        <data>-gjahr = it_bsis-gjahr.
        <data>-waers = it_bsis-waers.
        <data>-belnr = it_bsis-belnr.
        <data>-monat = it_bsis-monat.
        <data>-budat = it_bsis-budat.
        <data>-blart = it_bsis-blart.
        IF it_bsis-shkzg ='H'.
          <data>-wrbtr = it_bsis-wrbtr * -1.
          <data>-dmbtr = it_bsis-dmbtr * -1.
        ELSE.
          <data>-wrbtr = it_bsis-wrbtr.
          <data>-dmbtr = it_bsis-dmbtr.
        ENDIF.
        SELECT SINGLE
                     lifnr
                     sgtxt FROM bseg
                           INTO gs_vendor
                           WHERE bukrs = it_bsis-bukrs " --> Add this
                           AND belnr = it_bsis-belnr
                           AND gjahr IN p_gjahr
                           AND buzei = '001'.    " --> Add this
    *                       AND lifnr NE ''.     " --> Remove this
        SELECT SINGLE lifnr name1 stcd1
        FROM lfa1
        INTO gs_lfa1
        WHERE lifnr = gs_vendor-lifnr.
        <data>-lifnr = gs_lfa1-lifnr.
        <data>-sgtxt = gs_vendor-sgtxt.
        <data>-name1 = gs_lfa1-name1.
        <data>-stcd1 = gs_lfa1-stcd1.
        SELECT SINGLE wt_withcd
        FROM with_item
        INTO gs_item
        WHERE bukrs = it_bsis-bukrs  " --> Add this
        AND belnr = it_bsis-belnr
        AND gjahr IN p_gjahr.
        IF sy-subrc EQ 0.
          <data>-mwskz = gs_item.
        ENDIF.
        SELECT SINGLE ppnam usnam bldat
        FROM bkpf
        INTO gs_bkpf
        WHERE bukrs = it_bsis-bukrs   " --> Add this
        AND belnr = it_bsis-belnr
        AND gjahr IN p_gjahr.
        <data>-ppnam = gs_bkpf-ppnam.
        <data>-usnam = gs_bkpf-usnam.
        <data>-bldat = gs_bkpf-bldat.
      ENDLOOP.
    ENDFORM.
    Regards,
    RS

  • Optimizing Performance

    I am having a problem with my program as I am not getting the
    desired frame rate due to all the code that is getting executed per
    tick. So I have some questions about director and lingo as to which
    way actually executes faster.
    1. Multiple
    ExitFrame calls vs a single
    ExitFrame call.
    I have alot of sprites in my app. Almost all of them have an
    ExitFrame handler.
    Question: is it faster to have each sprite handle it's own
    ExitFrame routine and do code specific to that sprite or is
    it faster to have one generic
    ExitFrame to loop through and execute code for each sprite?
    2. Puppeted sprites vs Non-Puppeted sprites.
    I have a alot of sprites in my program. To make life ALOT
    easier, I simply allocated a good chunk of sprite channels to sole
    use of "dynamically created sprites". My program can have hunders
    of puppeted sprites from any given moment to the next.
    Question: Does director progress faster or slower depending
    on if a sprite is puppeted or not? Or is there any difference at
    all?
    3. Checking to see if a variable is set before setting it.
    I have only recently come into the Director/Lingo world of
    programming. I am originally a VB programmer for almost a decade.
    In visual basic, I have noticed that the code executes faster if
    you don't do unneeded variable assignments by checking to see if it
    was already set.
    Example: In visual basic, let's say you have an array of 1000
    elements, some elements are already set, some are not.
    for i = 1 to 1000
    var(i) = i
    next
    The above code executes fast, but if you are doing that very
    very often, it can be a bottle neck.
    the below code, while doing the exact same thing, actually is
    faster.
    for i = 1 to 1000
    if var(i) <> i then var(i) = i
    next
    In VB, it's faster to do a check of a variable than it is to
    do the assignment when it's not needed. Now granted, this is a poor
    example, usually I am dealing with much more complex routines, but
    the basic principle of what I am trying to get across is the same.
    Question: in Director/lingo, would it speed up the execution
    of code to do a variable check before the assignment, or is the
    very act of adding the check going to slow the down the execution?
    Anyone have any ideas about these? Or anyone have any other
    tips about stupid little things to speed up execution of
    code?

    >
    1. Multiple
    ExitFrame calls vs a single
    ExitFrame
    > call.
    You should consider dropping the exitframe approach, in favor
    of an oop
    model.
    OOP is not faster, as a dual core processor is not faster
    than a single core
    one running at double the speed. In fact, the second should
    be faster, since
    there is no synchronization penalty. However, it is much
    smoother. Same with
    oop, you have a penalty, since you are using more objects,
    but the objects
    can be smart enough to adjust the number of instructions they
    execute as
    required.
    If you e.g. have objects whose coordinates can be calculated
    and stored
    inside the object, you don't have to update the stage each
    time an object
    moves. You can do that once, for all objects in set
    intervals. Long as the
    interval is large enough to handle all intermediate
    processing and
    updatestage cost, you'll have a very smooth movie.
    >
    2. Puppeted sprites vs Non-Puppeted sprites.
    Puppeting does not affect performance -or at least it
    shouldn't. The number
    of sprites, and number of behaviors attached to each sprite
    does. However,
    even when there is a very large number of sprites active, the
    procedure
    should be a joke for any modern cpu. What does cost, is
    redrawing the
    sprites. So, if it's image sprites we are talking about, you
    should perhaps
    consider a single bitmap member you should use as a buffer,
    and imaging
    lingo for drawing each frame. The mouse click events can be
    evaluated by
    keeping a list of virtual sprite positions. Even if not
    familiar with the
    above, the time you'll invest in learning what is required,
    will be rewarded
    with a significant -up to times x- performance increase.
    >
    3. Checking to see if a variable is set before setting it.
    You can create a simple lingo benchmarking script to get your
    answers. As a
    general principle, the less commands the faster. Though not
    really into VB
    (I find c++ and lingo to be a killer combination), I can
    assume why this is
    happening: when setting a variable, vb is executing some code
    to evaluate
    what the value was, and what -if anything- has to be
    released. Though
    nowhere documented, it seems that several years ago, someone
    in the director
    dev team was smart enough to take this matter into account
    when creating the
    object that is known as a lingo variable (64bit internally,
    btw). So,
    director doesn't suffer slow variable release - releasing
    what shouldn't be
    released that is.
    > Anyone have any ideas about these? Or anyone have any
    other tips about
    > stupid
    > little things to speed up execution of code?
    You know, a few years ago, lingo performance/speeding up
    director was a
    regular discussion issue in this list. This is not the case
    anymore. And
    though I can guess a couple reasons why, I found none to be
    qualified as an
    explanation.. Not in my book at least. Case you have any more
    questions, I'd
    be happy to answer. Building a site with director performance
    hints /
    optimizing lingo code is high in my to do list.
    "DaveGallant" <[email protected]> wrote in
    message
    news:[email protected]...
    >I am having a problem with my program as I am not getting
    the desired frame
    > rate due to all the code that is getting executed per
    tick. So I have some
    > questions about director and lingo as to which way
    actually executes
    > faster.
    >
    >
    1. Multiple
    ExitFrame calls vs a single
    ExitFrame
    > call.
    >
    > I have alot of sprites in my app. Almost all of them
    have an
    >
    ExitFrame
    > handler.
    > Question: is it faster to have each sprite handle it's
    own
    >
    ExitFrame
    > routine and do code specific to that sprite or is it
    faster to have one
    > generic
    >
    ExitFrame to loop through and execute code for each sprite?
    >
    >
    2. Puppeted sprites vs Non-Puppeted sprites.
    >
    > I have a alot of sprites in my program. To make life
    ALOT easier, I simply
    > allocated a good chunk of sprite channels to sole use of
    "dynamically
    > created
    > sprites". My program can have hunders of puppeted
    sprites from any given
    > moment
    > to the next.
    > Question: Does director progress faster or slower
    depending on if a sprite
    > is
    > puppeted or not? Or is there any difference at all?
    >
    >
    3. Checking to see if a variable is set before setting it.
    >
    > I have only recently come into the Director/Lingo world
    of programming. I
    > am
    > originally a VB programmer for almost a decade. In
    visual basic, I have
    > noticed
    > that the code executes faster if you don't do unneeded
    variable
    > assignments by
    > checking to see if it was already set.
    >
    > Example: In visual basic, let's say you have an array of
    1000 elements,
    > some
    > elements are already set, some are not.
    >
    > for i = 1 to 1000
    > var(i) = i
    > next
    >
    > The above code executes fast, but if you are doing that
    very very often,
    > it
    > can be a bottle neck.
    > the below code, while doing the exact same thing,
    actually is faster.
    >
    > for i = 1 to 1000
    > if var(i) <> i then var(i) = i
    > next
    >
    > In VB, it's faster to do a check of a variable than it
    is to do the
    > assignment
    > when it's not needed. Now granted, this is a poor
    example, usually I am
    > dealing
    > with much more complex routines, but the basic principle
    of what I am
    > trying to
    > get across is the same.
    >
    > Question: in Director/lingo, would it speed up the
    execution of code to do
    > a
    > variable check before the assignment, or is the very act
    of adding the
    > check
    > going to slow the down the execution?
    >
    >
    >
    > Anyone have any ideas about these? Or anyone have any
    other tips about
    > stupid
    > little things to speed up execution of code?
    >

  • Cannot compile code with debug symbols

    I have a source code file that will not compile with debug symbols. I get an assertion failed in file ../src/regman/regman_local.cc at line 5224. The compile command and output are below.
    /opt/SUNWspro/bin/cc -g -xarch=v9b -xopenmp=noopt -xc99=all -c -o output/spirecon.o spirecon.c
    cg: assertion failed in file ../src/regman/regman_local.cc at line 5224
    cg: Out of range
    cg: 1 errors
    cc: cg failed for spirecon.c
    However without the debug options and using the default -fast switch, i.e.
    /opt/SUNWspro/bin/cc -fast -xarch=v9b -xopenmp=noopt -xc99=all -c -o output/spirecon.o spirecon.c
    it compiles without any problems.
    I was hoping someone might have a suggestion as to how what might cause this type of error.

    I have been told this is bugid: 4420630
    It only happens when you try to use the optimizing
    backend code generator without any optimization.
    (That's what -xopenmp=noopt does)
    If you add an -xO1 flag the assertion should go away, but you
    will also lose some (but not all) of your debuggability.
    --chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • What are the compiler generated codes for objective-c?

    After the compilation, the code for c/c++ is known as "object code" i.e. ".obj" file, and the binary executable file is ".exe" .
    Similarly for java the compiled code is known as ".class" file.
    In case of Objective-c what is the output of Compiler and what is the Executable file?

    Strictly speaking, .obj and .exe refer only to the output of the compiler and linker for a Windows system (or cross compiler).  For *nix compliant systems the output of the compiler is usually given a .o suffix and the executable produced after linking is named whatever you choose; but usually with no suffix at all.
    Also, technically speaking, Java .class fiels don't fit neatly into this paradigm.  The output of a Java compiler isn't object code, per se; it's optimized byte-code that can be run by the JRE.

Maybe you are looking for

  • Problem with control panel in vista on gx620

    My friend and i who just recently both bought the MSi gx620 notebook have a very strange problem. After a short while some of the objects in the control panel have become not functional. Things that does not worl is: Windows Update Windows power cont

  • Dreamweaver MX 6.1 Closes When Click on Help or Commands in Vista

    Just got a new machine - running Vista with Dreamweaver MX 6.1. When I click on the Toolbar - on Commands or Help - it closes the program. I just installed the updater to make it 6.1 - but it didn't help. Any ideas? Jess

  • ATG - Axis integration for existing web services

    Hello, I am currently using the web services as defined in the ATG2007.1/DPS/WebServices/userprofilingWebServices.ear I have a need to extend this to do pre-processing before hitting the getProfileId and my understanding is that I need to use a Handl

  • Mapping External Business Partner ID to Internal  Id

    Hi all, Is there a standard functionality to map a external BP to an internal one? Thanks a lot, Fabian

  • Business Delegate & Session Facade

    1 What is the need of Business delegate? For controlling the interactions between the presentation tier and business tier, session facade pattern can be used. 2 Can a session facade have all the facade related methods. (i.e. entire application has on