Performance 'killer' - what to do ?
hi,
i have the following code below. The problem is: table bkpf has about 10 millionen rows,
table zoa06 about 5 million rows. so the above coding takes about 23 hours
the first select of bkpf selects about 85.000 rows.
how can i optimize this code ?
best regards, Martin
SELECT * FROM bkpf INTO TABLE gt_bkpf1 WHERE blart = 'EI'. "06a Beginn
LOOP AT gt_bkpf1.
CONCATENATE gt_bkpf1-bukrs gt_bkpf1-belnr
gt_bkpf1-gjahr INTO gf_objid1.
SELECT SINGLE * FROM zoa06 WHERE object_id = gf_objid1.
IF sy-subrc <> 0.
SELECT SINGLE * FROM bkpf WHERE xblnr = gt_bkpf1-xblnr AND
bldat = gt_bkpf1-bldat AND
blart <> 'EI'.
IF sy-subrc = 0.
CONCATENATE bkpf-bukrs bkpf-belnr
bkpf-gjahr INTO gf_objid.
SELECT * FROM zoa06 WHERE object_id = gf_objid.
gf_doc_type = zoa06-reserve.
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
EXPORTING
archiv_id = zoa06-archiv_id
arc_doc_id = zoa06-arc_doc_id
ar_date = sy-datum
ar_object = zoa06-ar_object
mandant = sy-mandt
object_id = gf_objid1
sap_object = zoa06-sap_object
doc_type = gf_doc_type
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE a999 WITH 'Fehler ARCHIV_CONNECTION_INSERT'.
ENDIF.
ENDSELECT.
ENDIF.
ENDIF.
thank you all for your help. no i have optimized the select single statements. i do a select outside the loop into sorted tables, and then i do a READ TABLE..........and this is much much faster then the single select statement (haven't known
that before )
so the job was finished in 10 minutes(!!) instead of 23 hours !
best regards, Martin
SELECT * FROM bkpf INTO TABLE gt_bkpf1 WHERE blart = 'EI'. "06a Beginn
SELECT * FROM bkpf INTO TABLE gt_bkpf2 WHERE blart = 'RT' OR blart = 'GT'.
SELECT * FROM zoa06 INTO TABLE gt_zoa06 WHERE ar_object = 'ZOCPDWDA18' OR
ar_object = 'ZOCPDWDA26' OR
ar_object = 'ZOCPDWDA28'.
SORT gt_zoa06 BY object_id.
LOOP AT gt_bkpf1.
CONCATENATE gt_bkpf1-bukrs gt_bkpf1-belnr
gt_bkpf1-gjahr INTO gf_objid1.
READ TABLE gt_zoa06 WITH KEY object_id = gf_objid1 BINARY SEARCH.
IF sy-subrc <> 0.
READ TABLE gt_bkpf2 WITH KEY xblnr = gt_bkpf1-xblnr BINARY SEARCH.
IF sy-subrc = 0.
CONCATENATE gt_bkpf2-bukrs gt_bkpf2-belnr
gt_bkpf2-gjahr INTO gf_objid.
SELECT * FROM zoa06 WHERE object_id = gf_objid.
gf_doc_type = zoa06-reserve.
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
EXPORTING
archiv_id = zoa06-archiv_id
arc_doc_id = zoa06-arc_doc_id
ar_date = sy-datum
ar_object = zoa06-ar_object
mandant = sy-mandt
object_id = gf_objid1
sap_object = zoa06-sap_object
doc_type = gf_doc_type
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE a999 WITH 'Fehler ARCHIV_CONNECTION_INSERT'.
ENDIF.
ENDSELECT.
ENDIF.
ENDIF.
ENDLOOP. "06a Ende
Similar Messages
-
What is vendor performance report what are the fields using in the report
What is vendor performance report what are the fields using in the report and i need some sample reports for that particular topic (clasical report)not using any alvs or any advance topics.
U R Satish Patnaikhi
good
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
*--- ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
*--- Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
*--- Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP[] = T_CDPOS[].
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP[] = T_EKKO[].
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP[] = T_DATAELE[].
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
reward point if helpful.
thanks
mrutyun^ -
I have a 27" iMac and want to play Windows games with optimal performance. What do I need to do?
Install windows with Bootcamp. http://www.apple.com/support/bootcamp/
-
Does ios 7.1.1 improve battery performance ,also what is its effect on the speed of iphone 4s????
if it increase battery i want to know if it reduce the iphone speed ,as after ios 7.1 my iphone got more speed but the battery drainage increasedTx modular, I mean by speed the general performance of iPhone which optimized after iOS 7.1 but I am afraid to update to iOS 7.1.1 not to lose this perfect performance but also I need battery life optimization
-
Final Cut Pro X Performance Killed
Yosemite has ABSOLUTELY KILLED performance on Final Cut Pro. Despite running 20 cores, 2 x GPUs and loads of RAM, whenever FCP renders in the background, everything comes to a near COMPLETE STOP. I have to wait for all the background rendering to finish before I can do anything. It is adding HOURS to even simple projects. The only way to fix it and be able to use the machine is to either WAIT for the grass to grow or quite FCP then everything is back to normal.
Thank you *&%%^#$% Yosemite for another &*%@^&#$ set of issues.Still nothing has changed. I called Apple Support and finally got someone to do something. However I'm the only one having this problem (of course) and their 'bright' solution is to try a different disk. Really?! Thanks for nothing.
Today rending a 5 minute video from optimized which after 4 hours got to 95% (before Yosemite would take around 5 mins) and stopped there. After an hour at 95% I guessed it was screwed again so I quit FCP and rebooted. After reboot, FCP had completely reset itself and when I reopened the library, it reported all kinds of missing assets. I opened the library in finder (show package contents) and everything is still there. Repair permissions (which are again screwed up) helped nothing. What the f*$#@???? I open the project and everything is there as it should be and the rendered result in the timeline looks fine. When I try to export a master, FCP warns that it will be rendered with missing assets however it FINALLY rendered out without any issues. Thank GOD. Free if wretched FCPX, I can take the master now and re-compress it in Compressor and finally get it loaded. I'm only 48 hours late on the deadline thanks to this ongoing S@$t.
Thanks Apple for F&%@*&g me. A whole Saturday wasted yet again. Yosemite be damned. -
Raid performance. What do you get?
Hi All,
I'm setting up an XSan using 4 14*500Gigs XRaids + 1 XRaid for the metadata. Before installing XSan I'm testing the speed of the system when it's striped as a raid 0. We're using atto dual 4Gigabyte cards in the computers, together with a QLogic switch. Using 4 Raid5 slices, and striping them togethere as raid 0, I get speeds of about 250 Mbyte/s read, 300 Mbyte/s write using Decklinks speeddisk utility. What speeds do you get?
I've also posted this in the XSan forum, I guess it belongs in both.Hi Wout,
I have a 180x14 xserve raid with 512mb of cache. I have a PCI-X card and I seem to max out at 185mb/s write and around 235mb's read. This is on a Dual 2ghz G5. BTW performance seems pretty flat going from PCI to PCI-X and upgrading the caches from 128mb. Seems like the speed of the disks and controllers is the determining factor.
I'm experimenting with a 2nd xserve raid and I'll report the performance soon.
Cheers,
Sam -
Thought I would add to the previous threads. I have posted before about performance problems. Within minutes of use I end up with a 10 second delay. Just adjusting a clip length gives me a beach ball. In fact just touching the timeline is a 10 second delay... finally FCPX does not react at all... then a minute goes by.... and it comes to life again.... briefly. I am in a rough edit on a full length movie - split into 4 projects of 30min lengths.
I checked my set up: I am on a Retina MBP with 16Gb Ram, 2.6Ghz, etc running a thunderbolt display. I am running 2 x 3Tb thunderbolt ext. drives (gobs of space). I tested the drives at 160Mb/sec... so I ruled out hardware issues.
I thought it was due to my native avchd files.... so I spent 2 days transcoding to proxy media. Relinked fine and guess what... performance is just as bad... in Proxy Media!! This really amazed me.
Then other threads made me check the activity. On a fresh start I have 12Gb ram free and the remaining 4Gb for the system. After 30 minutes in FCPX I am now at 125Mb Ram ... memory is all gone and FCPX is on it's knees. So is the cause - have we established this?
So does anyone know how to proceed from here?Hi Jon...
Please report this issue to Feedback. I have dont the same - because it is a problem that we need to fix. Apple reads and takes it serious.
Just a little check list / Idea Scale
1) I trust that after converting to Proxy that you always switched the playback to Proxy in the preferences.
2) Open Activty Monitor and check FCPx threads when hitting playback on original & Proxy
3) Once you get into trouble meaning when your free available memory is approaching zero.. Open the Terminal and type "purge" without the quotes... Then hit enter... (It will take a while (up 30 Seconds)) to have effect.
4) As the available memory gets low... Does the inactive memory increase ?
5) Don't know whether you've read my thread on performance issues...
6) Try disk-separating your project from its event library.. As in ... If the event library is on disk A... Make sure that you create the new project which is to use the event lib. on disk A, on disk B or another disk. This WILL always speed up performance.
The specific problem you are having used to be something that I only saw on Snow Leopard. I have yet to experience that on ML -
Who is getting good lightroom performance and what is your system setup?
First of all, I think that most people are innoculated to terrible performance in lightroom. Many people running lightroom for a living are using incredibly fast machines and still having performance issues. There is something wrong with this picture!
Here are my system specs
i7 950 running a 3.3 ghz, 12gb ram, 1gb nvidia gts 450 graphics, windows 7 64 botting off of a crucial m4 ssd. My catalog is on the ssd along with preview files. My raw files and raw cache are on a raid 0 drive.
The terrible performance that drives me nuts simple things like cropping photos. In a given day of editing I might crop and rotate 500 files. This should be a fluid piece of lightroom's interface. In adobe camera raw hosted in bridge or photoshop cropping and straigtening photos was fluid on my 10 year old computer (and is perfectly fine on my current machine), but in lightroom sometimes it's smooth, and sometimes their is a bunch of lag when initially trying to crop or rotate. Syncing the previus development settings to the current photo takes several seconds? These are basic things. I've read all the threads, and tried all the fixes, and I am convinced that whatever current lag and slowness I'm experiencing is due to a software incompatibility with a piece of my hardware OR perhaps I'm running as smoothly as lightroom 4 is ever going to run.
I would like to know if there is anyone else out there who is having legitimally smooth performace out of lightroom 4.0, and if so, what are your system specs.Geoff
I've listed stats and issues above but specifics
Library
space / Z - wait 2 - 3 seconds - some days.... other times - like a rocket
everything else is perfectly acceptable - for version 4
Develop mode
Cropping
hit R and wait, 2 - 3 seconds
handles appear mouse click to grab / rotate / move - wait 2 - 4 seconds before there is any response - not often with the spinning thing
Zooming
space / Z - wait 2 - 3 seconds - some days.... other times - like a rocket
Lens correction
Manual rotate / vertical - usually acceptable, if you catch it right, you can increase / decrease quickly, otherwise its click - wait 2 - 4 seconds photo is adjusted....
horizontal - this is slow, significantly slower than the above for some reason.
HSL/Color / B&W
2 - 5 seconds - usually
Web
This is acceptable - I just have 1 image selected, so any refreshes affect that image, so there is none of that tedious web update
Slideshow
I've been using this with LRTimelapse, to export sequences of images to a preset, its just number crunching - go make a coffee or leave running to export 5 or 6 lots of 400+ images over night
Map
limited by internet speed, its fine the usual irritation of the reverse geo-coding not defaulting to put the data in is mindblowingly frustrating...
I don't use the print or book modules as a rule
Hope that helps Geoff
hamishNIVENPhotography -
Please help! I should be getting much better performance! What am I doing wrong?
Hi, there!
I've recently started using After Effects CC and I am getting extremely poor performance, especially given my machine specs (or so I believe).
Everything is very slow, including the actual software interface. Even with the Live Update switched off:
- Moving components on the actual composition view is practically impossible: click, drag, wait about 15seconds, release click and it has moved somewhat in the general direction required, but not even to the place the mouse stopped.
- Scrubbing doesn't work at all, even after the render bar on the timeview is already fully green.
- Standard preview (spacebar) can never play at realtime. The only way to play footage at realtime is to use RAM preview (numpad 0), but even then it takes ages to render small parts (10seconds of footage, takes anywhere between 5 and 10 minutes).
It's enfuriating! I am so convinced that my machine should perform SO much better than this!
I have tried everything that I can think of and everything that I have found on this forum and others through out the internet. Spent the last week googling this issue and have not made much improvement!
I have even checked the raytracker_supported_cards.txt file actually included the GeForce GTX 590. It does.
Any help anyone can provide would be much appreciated, cos I am stumped. Many thanks!
The following are the specs of my pc and the settings of my After Effects (relevant settings and settings I have changed from default):
PC
Components
Comments
Case
Cooler Master HAF X
PSU
Silverstion ST1500 (1500W)
Motherboard
Asus Rampage IV Formula
CPU
Intel Core i7-3960X (6 physical /12 virtual cores) @ 3.3GHz
CPU Cooler
Noctua NH-D14 SE2011
RAM
4x4GB G.Skill Ripjaws
GPUs
2x Zotac Gefore GTX 590 3GB (4 physical GPUs with 1.5GB RAM each)
Latest drivers installed
SSD
Crucial Technology M4 256GB
Used for OS, Applications and AE cache
HD1
Seagate Barracuda 2TB SATAIII 7200RPM
HD2
Western Digital VelociRaptor HDD 10,000RPM
Monitor
Samsung SyncMaster 305T (2560x1600)
OS
Windows 7 Ultimate
All up to date
After Effects
CC
Updated to latest version 12.2.1
After Effects
Preferences Heading
Setting
Set to/
Showing
Comments
General
Allow Scripts to Write Files and Acces Network
Ticked
Don't think this has anything to do with it, but it is something I changed from the default values.
Previews
Adaptive Resolution
1/8
Show Internal Wireframes
Unticked
Zoom Quality
Faster
Color Management Quality
Faster
Previews/GPU Information
Fast Draft
Available
Texture Memory
1115MB
Maximum allowed
Ray-tracing
GPU
OpenGL version
2.1.2
Even though my GPUs (GTX590) are capable of OpenGL 4.4
OpenGL Share Model
3.0
CUDA Driver Version
6.3
CUDA Devices
4
followed by "(GeForce GTX590, GeForce GTX590, GeForce GTX590, GeForce GTX590)"
CUDA Current Usable Memory
1150MB
CUDA Maximum Usable Memory
1500MB
Display
Harware Accelerate Comosition, Layer and Footage Panels
Ticked
Media and Disk Cache
Enable Disk Cache
Ticked
Maximum Disk Cache Size
60GB
Cache Folder
C:\AEcache
Conformed Media Database Folder
C:\AEcache
Conformed Media Cache Folder
C:\AEcache
Write XMP IDs to Files Import
Ticked
Create Layer Markers from Footage XMP Metadata
Ticked
Video Preview
Output Device
None
Auto-save
Automatically Save Projects
Unticked
Memory & Multiprocessing
Installed RAM
16GB
RAM reserved for other applications
6GB
RAM shared by AE
10GB
Reduce cahce size when system is low on memory
Unticked
Render Multiple Frames Simulatenously
Ticked
Only for Render Queue, not for RAM Preview
Unticked
Installed CPUs (processor cores)
12
CPUs Reserved for other applications
6
RAM allocation per background CPU
1.5 GB
Acutal CPUs that will be used
6
Other Options
Pixel Correction
OFF
Fast Preview
Adaptive Resolution
Have played with it in Fast Draft too, but rendering was quicked on Adaptive Resolution.
This is because for A.R. it uses multiprocessing, but for Fast Draft M.P. is disable (incompatible mode, it says).
Renderer
Classic 3D
Thanks again!Hi, Mylenium,
Thanks for your prompt reply, I'm afraid it hasn't helped. I don't see anything wrong in my device manager.
I have also gone and updated every driver, especially the motherboard chipset and the Sata Intel Rapid Storage Technology driver.
Unfortunately, this hasn't made any difference.
Any other suggestions?
Many thanks in advance!
Hugo -
GROWL is a mail killer, what do I need to replace?
Hi,
I installed the GROWL plugin a while ago and ever since the mail program has been almost unusable. Whenever it starts up it will not load a new message viewer window, I have to go in myself and open it. The badge that shows new mail on the icon does not work. It also will not quit!!!!!!! Will someone help me and let me know what I need to delete to have this fixed without losing my email messages?
Thank you,
Kevin WebsterHi kWebs,
I had this exact same problem when I installed Growl. What you need to do is:
- run the uninstall script
- go in to /library/Mail and ~/library/Mail and delete any Growl files you find
- finally (and this is what finally fixed it for me) delete your Mail preferences in the ~/library/Preferences folder (not your User preferences folder). The file is com.apple.mail something something.
Hope that works for you and solves the problem. -
Performance Monitor: what does ProcessingTime exactly mean
Hello,
we have to analyze the poor performance of our Idoc --> SOAP Implementation. In order to figure out,
where exactly the time get lost, we have re-check all stepts og the overall process. The Integration
Process makes some simple things:
- Receive Idoc
- map the dest. message
- Call Receiver by SOAP async
- read the Response, and set the status of the IDoc async.
All works fine but rather slow (not using the BPE is not an option!)
The Performance Monitor for the synchron SOAP Inbound Interface to the
receiving application tells us 1104 msg/h, respectively 2,172 sec/msg.
My question is, which time-periode do these numbers exactly span? Is
this the duration simply for the begin/end of the SOAP-Call independent
of the BPE? In other words: how and where can i see, whether the poor
performance comes from the fact, that the BPE just fires so few messages
per minute via the interface, or the SOAP-Call itselfs is very slow?
If the latter is true, the bad performance would have nothing to do with the
BPE but simply with the SOAP-Server, right?
Thanks in advance
GunnarHi,
Please go through the below links, these will help you to analyse about the performance issues
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/489f5844-0c01-0010-79be-acc3b52250fd
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/defd5544-0c01-0010-ba88-fd38caee02f7?prtmode=navigate
/people/prasad.illapani/blog/2007/04/27/performance-tuning-checks-in-sap-exchange-infrastructurexi-part-iii
Thanks
Swarup -
FB4 Performance profiling - what's up with [tincan]?
Hello folks,
I just profiled my application in FB4 and when viewing the performance profile that was recorded there is an entry with name "[tincan]", which claims around 70 to 90% of all time.
Reading blogs etc I found that tincan is the time spend on rendering a video?! This doesn't make sense, of course, and my conclusion at this point is that profiling in FB4 is useless.
Any help? Thanks!Hey folks,
any thoughts on this one? -
Java Multithreaded performance decrease, what am I doing wrong?(winXP)
Greetings Everyone,
I have a question. I am experiencing some strange result in my Java application. I(we actually) made a Ray tracing program, which runs inside a Frame(awt) and for every pixel it uses a Ray class to determine the colour of the pixel.
As the program was originally single threaded I rewrote it to multi threaded by rewriting the render method like this:
( a quick description first to make it a bit more comprehensible)
There is one class named Tracer...which extends Frame and in its main it creates a new Tracer. Tracer contains a lot of public statics containing all the screen en scene info(objects, lights...), but also a static Tracer object which is the Tracer created inside the main, this access the non static methods...(not a very nice way of doing this...but for now it ended up like this...thus Tracer.mainFrame is actually the Tracer object created in the main and used to access non static methods...)
public void render() {
pixelBuffer = new int[ width*height ];
imageSource = new MemoryImageSource( width, height, pixelBuffer, 0, width );
imageSource.setAnimated( true );
offscreenImage = Toolkit.getDefaultToolkit().createImage( imageSource );
ToneMapper toneMapper = new ToneMapper( gamma );
startTimeRend = System.currentTimeMillis();
for( int y=0; y<height; ++y ) {
for( int x=0; x<width; ++x ) {
int index = (height-y-1)*width + x;
Vec3 color = tracePixel( x, y );
pixelBuffer[ index ] = toneMapper.map( color.x, color.y, color.z );
if( (y&7) == 0 ) paint( getGraphics() );
//Visually it could still miss a bar...this is to display the full image:)
paint( getGraphics());
long time = System.currentTimeMillis() - startTimeRend;
System.out.println( "Finished raytracing in " + time/1000.0f + "s." );
}To this: (startTimeRend is class float)
public void render(int threads) {
pixelBuffer = new int[ width*height ];
imageSource = new MemoryImageSource( width, height, pixelBuffer, 0, width );
imageSource.setAnimated( true );
offscreenImage = Toolkit.getDefaultToolkit().createImage( imageSource );
startTimeRend = System.currentTimeMillis();
int yParts = (int) (height /threads);
threadsRunning = threads;
for(int i=0;i<threads;i++){
RenderThread rendT = new RenderThread(i*yParts,(i+1)*yParts);
rendT.start();
public void renderV(int from, int to) {
ToneMapper toneMapper = new ToneMapper( gamma );
for(int y=from;y<to;y++){
for( int x=0; x<width; ++x ) {
int index = (height-y-1)*width + x;
//while(index<0){index = (height-y-1)*width + x;}
Vec3 color = tracePixel( x, y );
pixelBuffer[ index ] = toneMapper.map( color.x, color.y, color.z );
paint( getGraphics() );
finishRender();
public void finishRender(){
threadsRunning--;
if(threadsRunning<=0){
paint( getGraphics());
long time = System.currentTimeMillis() - startTimeRend;
System.out.println( "Finished raytracing in " + time/1000.0f + "s." );
progThread.dispose();
}And the thread class I useclass RenderThread extends Thread implements Runnable{
int pixelYfrom = 0;
int pixelYto = 0;
RenderThread(int from, int to){
if(from!=to){
if(from<to){
pixelYfrom = from;
pixelYto = to;
}else{
pixelYfrom = from;
pixelYto = to;
public void run() {
Tracer.mainFrame.renderV(pixelYfrom, pixelYto);
}Where render(x) the x is the number of threads to use(obviously).
The strange thing is though. That even though both methods render almost identically and give the the the same result the single threaded render runs faster than the multi threaded render when using 4-8 threads. When using 2 threads it seems to be going slightly faster. I haven't tested 3 though. My question is why? When using 2 threads I get only 50% total usage(I have a Quad core running at 2.66Ghz) and with 4 threads I get around the 95% and with 8 threads about 75%(which is also strange, though I guess it might have something to do with more scheduling) So why are 2 threads faster than 4?(I guess 2 are bit better then the single threaded version, though I don't know its effects on a dual-core machine)
and is there a way to fix this? So that I can use the 95% of my pc and still get an adequate performance increase.(I wrote the code almost identically in C++ and there the thread increase would cause a performance increase(especially around the 4-5 threads), but it doesn't seem to work here.)
Thanks in advance
Edited by: NeoAngelus on Sep 26, 2008 11:00 AM extra infoI think I have a reasonable test program for testing the hypothesis that the cause of the problem is cache locality wrt writing to the shared pixel buffer. (It could also be used as inspiration for the OP on how to manage the threads.)
package awt;
import java.util.GregorianCalendar;
import java.util.concurrent.CountDownLatch;
public class MultiThreadedPainting {
public static void main(String[] args) throws InterruptedException {
int width = 1600;
int height = 1200;
int[] buffer = new int[width * height];
render(width, height, buffer, 1);
render(width, height, buffer, 2);
render(width, height, buffer, 4);
render(width, height, buffer, 8);
private static void render(int width, int height, int[] buffer, int threadCount) throws InterruptedException {
CountDownLatch start = new CountDownLatch(threadCount + 1);
CountDownLatch end = new CountDownLatch(threadCount);
for (int i = 0; i < threadCount; i++) {
Thread thread = new Thread(new RenderJob(start, end, buffer, width, i * height / threadCount, (i + 1) * height / threadCount));
thread.start();
long time = System.currentTimeMillis();
start.countDown();
end.await();
System.out.println("Time elapsed " + (System.currentTimeMillis() - time));
private static class RenderJob implements Runnable {
private final CountDownLatch startLatch;
private final CountDownLatch endLatch;
private final int[] buffer;
private final int width;
private final int fromY;
private final int toY;
public RenderJob(CountDownLatch startLatch, CountDownLatch endLatch, int[] buffer, int width, int fromY, int toY) {
this.startLatch = startLatch;
this.endLatch = endLatch;
this.buffer = buffer;
this.width = width;
this.fromY = fromY;
this.toY = toY;
@Override
public void run() {
System.out.println("Rendering from " + fromY + " to " + toY);
try {
startLatch.countDown();
startLatch.await();
for (int y = fromY; y < toY; y++) {
for (int x = 0; x < width; x++) {
buffer[y * width + x] = calc(x, y);
endLatch.countDown();
catch (InterruptedException e) {
// let thread die
private int calc(int x, int y) throws InterruptedException {
// just do something moderately expensive to emulate rendering
return x * y * new GregorianCalendar().hashCode();
}I wouldn't expect problems concerning writing to the pixel buffer; it is done sensibly by the OP: each thread writes to a contiguous block of ints because the problem is split by y coordinates.
Edited by: nygaard on Sep 26, 2008 10:10 PM -
ADDM performance finding / what should be the solution
I am getting these message at ADDM , without any recommendation , what shoud be solution.
Finding Wait class "Other" was consuming significant database time.
Impact (minutes) 1,943.1
Impact (%) 99.67
Database latches in the "Other" wait class were not consuming significant database time.Hello
Many others are having this problem with ML and macbooks. You could try resetting the SMC like so: http://support.apple.com/kb/HT3964?viewlocale=en_US&locale=en_US
Or view another of the many posts about the same problem here: https://discussions.apple.com/thread/4144587?start=0&tstart=0
Sorry I can't help much more than that because I don't have a Macbook myself.
xeni -
Application that monitors network, shows performance and what's slowing it?
Does anyone know any application that could tell me how my network is doing, which computers are currently slowing it and all that type of information that might help me fix problems I'm having? We got several computers in the company, but for some reason the internet and networking is just slow, we've been trying to find out but nothing has worked out yet.
I use my Macbook with a port mirror from the network switch and run EtherApe to see who is hogging the network bandwidth.
Works nicely but you need:
- a switch that support port mirror/monitoring
- Macports with EtherApe install
Might be a little over the top unless you're the IT guy like me
Maybe you are looking for
-
How can I make a calender entry that makes a sound when it is its turn?
How can I make a calender entry that makes a sound when it is its turn?
-
Adobe PDF iFilter 9 for 64-bit platforms
How do I search for a two word phrase as in 'style analysis'. The software is finding 'style' and 'analysis' not the phrase
-
LaserJet 1015 on Win 7 (32-bit) won't print double-sided
I was always able to print double sided on XP without any problem. But after I got a new PC with Windows 7 Professional, 32-bit (with driver from win 7 itself), it would no print double-sided anymore, even though I checked the option for it in the pr
-
Enlarge an image when clicked in a report
Hi i am using Apex 4.2.2 I have a requirement where I can display images in a report. Images are stored as blob in the database. I created an interactive report and I can display the image in the report. But when I need to know when I clicked on the
-
Cross tab Header display..problem!
I have cross tab report in that we wanted to give user drag and drop option,but when the user drags and drops a new object the name of that object will not come automatically. i have tried in other ways to get that but unable to.Could somebody sygges