@@ -56,21 +56,16 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> {
5656 private async updateExpShow ( ) {
5757 await this . updateBranches ( )
5858 const branches = this . experiments . getBranchesToShow ( )
59- let gitLog = ''
60- const rowOrder : { branch : string ; sha : string } [ ] = [ ]
6159 const availableNbCommits : { [ branch : string ] : number } = { }
62- const args : Args = [ ]
6360
61+ const promises = [ ]
6462 for ( const branch of branches ) {
65- gitLog = await this . collectGitLogAndOrder (
66- gitLog ,
67- branch ,
68- rowOrder ,
69- availableNbCommits ,
70- args
71- )
63+ promises . push ( this . collectGitLogByBranch ( branch , availableNbCommits ) )
7264 }
7365
66+ const branchLogs = await Promise . all ( promises )
67+ const { args, gitLog, rowOrder } = this . collectGitLogAndOrder ( branchLogs )
68+
7469 const expShow = await this . internalCommands . executeCommand < ExpShowOutput > (
7570 AvailableCommands . EXP_SHOW ,
7671 this . dvcRoot ,
@@ -81,16 +76,13 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> {
8176 return { availableNbCommits, expShow, gitLog, rowOrder }
8277 }
8378
84- private async collectGitLogAndOrder (
85- gitLog : string ,
79+ private async collectGitLogByBranch (
8680 branch : string ,
87- rowOrder : { branch : string ; sha : string } [ ] ,
88- availableNbCommits : { [ branch : string ] : number } ,
89- args : Args
81+ availableNbCommits : { [ branch : string ] : number }
9082 ) {
9183 const nbOfCommitsToShow = this . experiments . getNbOfCommitsToShow ( branch )
9284
93- const [ branchGitLog , totalCommits ] = await Promise . all ( [
85+ const [ branchLog , totalCommits ] = await Promise . all ( [
9486 this . internalCommands . executeCommand (
9587 AvailableCommands . GIT_GET_COMMIT_MESSAGES ,
9688 this . dvcRoot ,
@@ -103,18 +95,31 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> {
10395 branch
10496 )
10597 ] )
106- gitLog = [ gitLog , branchGitLog ] . join ( COMMITS_SEPARATOR )
98+
10799 availableNbCommits [ branch ] = totalCommits
108100
109- for ( const commit of branchGitLog . split ( COMMITS_SEPARATOR ) ) {
110- const [ sha ] = commit . split ( '\n' )
111- rowOrder . push ( { branch, sha } )
112- if ( args . includes ( sha ) ) {
113- continue
101+ return { branch, branchLog }
102+ }
103+
104+ private collectGitLogAndOrder (
105+ branchLogs : { branch : string ; branchLog : string } [ ]
106+ ) {
107+ const rowOrder : { branch : string ; sha : string } [ ] = [ ]
108+ const args : Args = [ ]
109+ const gitLog : string [ ] = [ ]
110+
111+ for ( const { branch, branchLog } of branchLogs ) {
112+ gitLog . push ( branchLog )
113+ for ( const commit of branchLog . split ( COMMITS_SEPARATOR ) ) {
114+ const [ sha ] = commit . split ( '\n' )
115+ rowOrder . push ( { branch, sha } )
116+ if ( args . includes ( sha ) ) {
117+ continue
118+ }
119+ args . push ( ExperimentFlag . REV , sha )
114120 }
115- args . push ( ExperimentFlag . REV , sha )
116121 }
117- return gitLog
122+ return { args , gitLog : gitLog . join ( COMMITS_SEPARATOR ) , rowOrder }
118123 }
119124
120125 private async updateBranches ( ) {
0 commit comments